Socket
Socket
Sign inDemoInstall

last-line-stream

Package Overview
Dependencies
10
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    last-line-stream

A PassThrough stream that keeps track of last line written


Version published
Weekly downloads
34K
decreased by-1.19%
Maintainers
1
Install size
200 kB
Created
Weekly downloads
 

Readme

Source

last-line-stream

A PassThrough stream that keeps track of last line written.

Build Status Coverage Status

Install

$ npm install --save last-line-stream

Usage

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.

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

Keywords

FAQs

Last updated on 12 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc