JSPM

char-split

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6798
  • Score
    100M100P100Q123292F
  • License zlib

splits an stream on a character (e.g. \n) and emits the strings in between

Package Exports

  • char-split

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (char-split) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

char-split

Splits an stream on a character (e.g. \n) and emits the strings in between

Install

npm install char-split

Usage / Examples

var split = require('char-split')

stream.pipe(
    split()
        .on('data', function(data) {
            // line of text
        })
        .on('end', function(data) {
            // end of stream
        })
        .on('error', function(error) {
            // error in stream
        })
)

Optional arguments:

split(character = '\n', encoding = 'utf8')

Notes

For simplicity, char-split doesn't support multi-character split strings. This means splitting on \r\n won't work.

License

Open source software under the zlib license.