summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/mississippi/readme.md
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/mississippi/readme.md')
-rw-r--r--deps/npm/node_modules/mississippi/readme.md43
1 files changed, 13 insertions, 30 deletions
diff --git a/deps/npm/node_modules/mississippi/readme.md b/deps/npm/node_modules/mississippi/readme.md
index 5fa6d66c89..569803865c 100644
--- a/deps/npm/node_modules/mississippi/readme.md
+++ b/deps/npm/node_modules/mississippi/readme.md
@@ -74,7 +74,7 @@ var split = require('split2')
var newLineSeparatedNumbers = fs.createReadStream('numbers.txt')
var pipeline = miss.pipeline(newLineSeparatedNumbers, split())
-miss.each(pipeline, eachLine, done)
+var each = miss.each(pipeline, eachLine, done)
var sum = 0
function eachLine (line, next) {
@@ -94,8 +94,6 @@ function done (err) {
Builds a pipeline from all the transform streams passed in as arguments by piping them together and returning a single stream object that lets you write to the first stream and read from the last stream.
-If you are pumping object streams together use `pipeline = miss.pipeline.obj(s1, s2, ...)`.
-
If any of the streams in the pipeline emits an error or gets destroyed, or you destroy the stream it returns, all of the streams will be destroyed and cleaned up for you.
#### original module
@@ -156,7 +154,7 @@ var duplexCurl = miss.duplex(curl.stdin, curl.stdout)
### through
-##### `var transformer = miss.through([options, transformFunction, flushFunction])`
+#####`var transformer = miss.through([options, transformFunction, flushFunction])`
Make a custom [transform stream](https://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform).
@@ -196,7 +194,7 @@ miss.pipe(read, uppercaser, write, function (err) {
### from
-##### `miss.from([opts], read)`
+#####`miss.from([opts], read)`
Make a custom [readable stream](https://nodejs.org/docs/latest/api/stream.html#stream_class_stream_readable).
@@ -239,17 +237,17 @@ fromString('hello world').pipe(process.stdout)
### to
-##### `miss.to([options], write, [flush])`
+#####`miss.to([options], write, [flush])`
Make a custom [writable stream](https://nodejs.org/docs/latest/api/stream.html#stream_class_stream_writable).
-`opts` contains the options to pass on to the WritableStream constructor e.g. for creating a writable object stream (or use the shortcut `miss.to.obj([...])`).
+`opts` contains the options to pass on to the WritableStream constructor e.g. for creating a readable object stream (or use the shortcut `miss.to.obj([...])`).
Returns a writable stream that calls `write(data, enc, cb)` when data is written to the stream.
- `data` is the received data to write the destination.
- `enc` encoding of the piece of data received.
-- `cb(err, data)` should be called when you're ready to write more data, or encountered an error.
+- `next(err, chunk)` should be called when you're ready to write more data, or encountered an error.
`flush(cb)` is called before `finish` is emitted and allows for cleanup steps to occur.
@@ -293,7 +291,7 @@ finished
### concat
-##### `var concat = miss.concat(cb)`
+#####`var concat = miss.concat(cb)`
Returns a writable stream that concatenates all data written to the stream and calls a callback with the single result.
@@ -309,18 +307,13 @@ Note that `miss.concat` will not handle stream errors for you. To handle errors,
```js
var fs = require('fs')
+var concat = require('concat-stream')
var readStream = fs.createReadStream('cat.png')
-var concatStream = miss.concat(gotPicture)
-
-function callback (err) {
- if (err) {
- console.error(err)
- process.exit(1)
- }
-}
+var concatStream = concat(gotPicture)
-miss.pipe(readStream, concatStream, callback)
+readStream.on('error', handleError)
+readStream.pipe(concatStream)
function gotPicture(imageBuffer) {
// imageBuffer is all of `cat.png` as a node.js Buffer
@@ -335,7 +328,7 @@ function handleError(err) {
### finished
-##### `miss.finished(stream, cb)`
+#####`miss.finished(stream, cb)`
Waits for `stream` to finish or error and then calls `cb` with `(err)`. `cb` will only be called once. `err` will be null if the stream finished without error, or else it will be populated with the error from the streams `error` event.
@@ -361,7 +354,7 @@ miss.finished(copyDest, function(err) {
### parallel
-##### `miss.parallel(concurrency, each)`
+#####`miss.parallel(concurrency, each)`
This works like `through` except you can process items in parallel, while still preserving the original input order.
@@ -399,13 +392,3 @@ miss.pipe(
})
)
```
-
-## see also
-
-- [substack/stream-handbook](https://github.com/substack/stream-handbook)
-- [nodejs.org/api/stream.html](https://nodejs.org/api/stream.html)
-- [awesome-nodejs-streams](https://github.com/thejmazz/awesome-nodejs-streams)
-
-## license
-
-Licensed under the BSD 2-clause license.