diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/last-line-stream/readme.md | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/last-line-stream/readme.md')
-rw-r--r-- | node_modules/last-line-stream/readme.md | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/node_modules/last-line-stream/readme.md b/node_modules/last-line-stream/readme.md new file mode 100644 index 000000000..de6922adc --- /dev/null +++ b/node_modules/last-line-stream/readme.md @@ -0,0 +1,71 @@ +# last-line-stream + +> A PassThrough stream that keeps track of last line written. + +[](https://travis-ci.org/jamestalmage/last-line-stream) [](https://coveralls.io/github/jamestalmage/last-line-stream?branch=master) + + +## Install + +``` +$ npm install --save last-line-stream +``` + + +## Usage + +```js +const lastLineStream = require('last-line-stream'); + +const stream = lastLineStream(); + +stream.write('foo'); + +assert(stream.lastLine === 'foo'); + +stream.write('bar'); + +assert(stream.lastLine === 'foobar'); + +stream.write('baz\nquz'); + +assert(stream.lastLine === 'quz'); +``` + + +## API + +### lastLineStream([pipeTo]) + +Returns a new instance of the spying PassThrough stream, + +#### pipeTo + +Type: `stream` + +If supplied, the new instance will automatically be piped to this stream. + +### stream.lastLine + +Type: `string` + +The last line written out to this stream. The `lastLine` value will grow until the stream sees a newline character (`'\n'`). + +## Low Level API + +A low-level non-stream based API is available. It has only two methods. + +```js +var createTracker = require('last-line-stream/tracker'); +var tracker = createTracker(); + +// append some text. +tracker.update(someString); + +// Find the complete last line of all the text appended. +tracker.lastLine(); +``` + +## License + +MIT © [James Talmage](http://github.com/jamestalmage) |