streamwrapper

This module implements stream wrapper.

Since version 1.2.

Types

PipeOutStream[T] = ref object of T
  buffer: Deque[char]
  baseReadLineImpl: typeof(StreamObj.readLineImpl)
  baseReadDataImpl: typeof(StreamObj.readDataImpl)
  Source Edit

Procs

proc newPipeOutStream[T](s: sink (ref T)): owned PipeOutStream[T]

Wrap pipe for reading with PipeOutStream so that you can use peek* procs and generate runtime error when setPosition/getPosition is called or write operation is performed.

Example:

import osproc, streamwrapper
var
  p = startProcess(exePath)
  outStream = p.outputStream().newPipeOutStream()
echo outStream.peekChar
p.close()
  Source Edit