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

buffer-split-transform

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buffer-split-transform

creates a transform stream that splits chunks without intermediate string conversion

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

buffer-split-transform

Creates a transform stream that splits chunks without intermediate string conversion.

usage

import split from 'buffer-split-transform'

// source is a readable stream which emits:
// <Buffer 74 68 69 73 20 69 73 0a 69 74>
const sink = source.pipe(split())

sink.on(`data`, console.log)
// <Buffer 74 68 69 73 20 69 73>
// <Buffer 69 74>

api

split([delimiter], [options])

delimiter if set overrides the default delimiter of Buffer.from('\n').

options defualts to:

{ flushRemainingChunk: true }

If flushRemainingChunk is set to false, the remainder of a split chunk will be omitted when the source stream ends. This can be useful if you are only interested in data before the specified delimiter.

In cases where extra verbosity is desired, split can be called like so:

split({
  delimiter: Buffer.from(`\n\n`),
  flushRemainingChunk: false
})

Keywords

FAQs

Package last updated on 24 Nov 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

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