
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
Unpack multibyte binary values from buffers and streams. (Maintenance fork of substack's `binary`)
Unpack multibyte binary values from buffers and streams. (Maintenance fork of
substack's binary)
You can specify the endianness and signedness of the fields to be unpacked too.
This module is a cleaner and more complete version of bufferlist's binary module that runs on pre-allocated buffers instead of a linked list.
npm install binary
See the docs/examples/ directory.
var binary = require('binary-pmb')
Return a new writable stream b that has the chainable methods documented below
for buffering binary input.
Parse a static buffer in one pass. Returns a chainable interface with the
methods below plus a vars field to get at the variable stash as the
last item in a chain.
In parse mode, methods will set their keys to null if the buffer isn't big
enough except buffer() and scan() which read up up to the end of the buffer
and stop.
See binary.parse.
Parse bytes in the buffer or stream given:
These functions won't start parsing until all previous parser functions have run and the data is available.
The result of the parse goes into the variable stash at key.
If key has dots (.s), it refers to a nested address. If parent container
values don't exist they will be created automatically, so for instance you can
assign into dst.addr and dst.port and the dst key in the variable stash
will be { addr : x, port : y } afterwards.
Take size bytes directly off the buffer stream, putting the resulting buffer
slice in the variable stash at key.
vars lookup: If size is a string, use the value at vars[size].
The key follows the same dotted address rules as the word functions.
Same as .buffer but decode the data as a string.
Default encoding is latin1.
Same as .buffer but decode the data as a UTF-8 string.
Jump dist bytes ahead.
The "vars lookup" feature from .buffer applies to dist.
Search for buffer in the stream and store all the intervening data in the
stash at at key, excluding the search buffer. If buffer passed as a string,
it will be converted into a Buffer internally.
For example, to read in a line you can just do:
var b = binary()
.scan('line', new Buffer('\r\n'))
.tap(function (vars) {
console.log(vars.line)
})
;
stream.pipe(b);
The callback cb is provided with the variable stash from all the previous
actions once they've all finished.
You can nest additional actions onto this inside the callback.
Like .tap(), except all nested actions will assign into a key in the vars
stash.
Loop, each time calling cb(end, vars) for function end and the variable
stash with this set to a new chain for nested parsing. The loop terminates
once end is called.
Clear the variable stash entirely.
MIT
FAQs
Unpack multibyte binary values from buffers and streams. (Maintenance fork of substack's `binary`)
We found that binary-pmb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.