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.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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 11 Feb 2017

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