Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

split-by-header

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

split-by-header

Split binary streams by length fields in messages' headers

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
6
500%
Maintainers
1
Weekly downloads
 
Created
Source

split-by-header

Split binary streams by length fields in messages' headers.

Use this for example to parse streaming data without writing a streaming parser if your chunks are reasonably small.

Usage

var split = require('split-by-header')

binaryStream
  .pipe(split({ type : 'UInt24BE', offset : 1 }))
  .pipe(process.stdout)

API

split(cfg)

cfg can be an object with those fields:

  • type: Type of the length value. Supported are {8,16,24,32} bit (un)signed integers in BE & LE. See node api
  • offset: Position to start reading from (optional)
  • modifier: the real length is returned by the modifier (optional)

If cfg is a string, it sets cfg.type:

split('UInt24BE')

License

(MIT)

Keywords

split

FAQs

Package last updated on 20 Nov 2012

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