🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

web-byline

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-byline

Line-by-line Stream transformer for web

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

web-byline

Line-by-line Stream transformer for web

(A ported version of jahewson/node-byline for using with whatwg streams) If you want to use byLine in node, then i recomend jahewson package

Currently only ReadableStream is implemented in Blink. TransformStream + WritableStream are on the way to be finilized. Until then you need web-stream-polyfill

The byline module can be used as a function to quickly pipe throught a readable stream to a WritableStream:

  rs = new ReadableStream({...})
  ws = new WritableStream({ write: console.log }
  
  rs.pipeThrough(byLine())
    .pipeTo(ws)

To read a large CSV from a file (or input) for example you can include Screw-FileReader to turn a blob into a stream

Example here: https://jsfiddle.net/gp802r79/
And below:

file = new File([content], 'large data.csv')
stdout = new WritableStream({ write: console.log }

file
  .stream()
  .pipeThrough(byLine())
  .pipeTo(stdout)

Empty Lines

byline skips empty lines

Unlike other modules (of which there are many), web-byline contains no:

  • monkeypatching
  • dependencies (except for stream polyfill)
  • CoffeeScript
  • Unnecessary code
  • minifed version
  • es6-to-es5 transformation
  • I expect you to write decent code and use const, let, classes and all that and simply include this in your own build process since you are probably going to minify it anyway.
  • So a decient browser won't suffer cuz of other.
    "The only way to truly force the web to embrace modern open standards is to invalidate old technology."

FAQs

Package last updated on 15 Sep 2016

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