std/streamwrapper

Source   Edit  

This module implements stream wrapper.

Since version 1.2.

Types

PipeOutStream[T] = ref object of T
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 std/[osproc, streamwrapper]
var
  p = startProcess(exePath)
  outStream = p.outputStream().newPipeOutStream()
echo outStream.peekChar
p.close()

Source   Edit