Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

line-stream

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

line-stream

split/binary-split but lines contain byte offset in the source stream and gives access to last line fragment

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by12.68%
Maintainers
1
Weekly downloads
 
Created
Source

line-stream

split/binary-split but lines contain byte offset in the source stream and gives access to last line fragment

  • this module leaves the delimiter on the resulting buffer.
  • all values are cast to buffers and emitted as buffers.
  • this module is just as fast as binary-split.
var linestream = require('line-stream');
var s = linestream();

s.on('data',function(line){
  console.log('line of data ',line+'');
  console.log('i come from ',line.start,'byte offset in the file')
})

fs.createReadStream(somefile).pipe(s);

api

var linestream = require('line-stream');

  • transform stream (through2)

linestream(delimiter) || linestream({delimiter:os.EOL,start:0})

  • returns transform stream.
  • options
    • delimiter, defaults to os.EOL but can be anything
    • start, defaults to 0. this is an offset applied to the start property of each line's "line.start" property. just helpful.

stream

  • properties
    • stream.fragment, at any time this property contains the fragment of the last incomplete line or an empty buffer.
  • events, in addition to standard stream events this module also emits
    • fragment, emits before end if there is a line fragment in the fragment property.

Keywords

FAQs

Package last updated on 16 Dec 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc