0.1.0 • Published 11 years ago

min-stream-node v0.1.0

Weekly downloads
1
License
-
Repository
github
Last release
11 years ago

min-stream-node

This module contains some helper functions for converting node streams into min-streams and sinks.

The interface for sources and sinks is in the min-stream documentation.

streamToSource(readableStream) -> source

Converts a readable stream to a min-stream source.

streamToSink(writableStream, end) -> sink

Converts a writable stream to a min-stream sink.

If the optional end argument is false, then the node stream won't have .end() called on it when the stream ends.

wrapStream(stream) -> minStream

Wraps a single stream into an object with source and sink properties. It will only add the properties if the node stream claims to be readable and/or writable.

// Here is an example creating a duplex min-stream manually
var stdio = {
  source: streamToSource(process.stdin),
  sink: streamToSink(process.stdout, false)
};

// If we have an existing duplex node stream, we can do it in one shot.
var stream = net.connect(8080, function () {
  var socket = wrapStream(stream);
  // socket now has .source() and .sink() properties.
});
0.1.0

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago

0.0.0

11 years ago