Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
binary-buffer-parser
Advanced tools
A binary buffer parser with support for infinite sized files
A binary buffer parser with support for infinite sized files.
binary-buffer-parser is installable via:
git clone https://github.com/Pupix/binary-buffer-parser.git
npm install binary-buffer-parser
yarn add binary-buffer-parser
Parsing buffers
const BinaryParser = require('binary-buffer-parser');
const buffer = Buffer.from('Hello world!');
const bufferParser = new BinaryParser(buffer);
console.log(bufferParser.int8()); // 72
console.log(bufferParser.uint32()); // 1869376613
console.log(bufferParser.string(parser.size())) // Hello World!
Parsing files
const BinaryParser = require('binary-buffer-parser');
const fileParser = new BinaryParser();
fileParser.open('/path/to/file');
console.log(fileParser.int8());
console.log(fileParser.uint32());
fileParser.close();
Reads an 8 bit signed integer from the buffer / file.
Arguments
Reads an 8 bit unsigned integer from the buffer / file.
Arguments
Reads a 16 bit signed integer from the buffer / file.
Arguments
Reads a 16 bit unsigned integer from the buffer / file.
Arguments
Reads a 24 bit signed integer from the buffer / file.
Arguments
Reads a 24 bit unsigned integer from the buffer / file.
Arguments
Reads a 32 bit signed integer from the buffer / file.
Arguments
Reads a 32 bit unsigned integer from the buffer / file.
Arguments
Reads a 64 bit signed integer from the buffer / file.
Note: JavaScript does not represent 64 bit integers correctly, so the result will be returned as a string
Arguments
Reads a 64 bit unsigned integer from the buffer / file.
Note: JavaScript does not represent 64 bit integers correctly, so the result will be returned as a string
Arguments
Reads a 16 bit floating point number from the buffer / file.
Arguments
Reads a 32 bit floating point number from the buffer / file.
Arguments
Reads a 64 bit signed integer from the buffer / file.
Arguments
Reads an ASCII string from the buffer / file.
Parameters
Reads a null terminated ASCII string from the buffer.
Reads an UTF16 string from the buffer / file.
Parameters
Reads a null terminated UTF16 string from the buffer.
Reads an unsigned 8 bit integer from the buffer and returns an array with true
/false
based on the values of each bit.
Arguments
Reads an unsigned 16 bit integer from the buffer and returns an array with true
/false
based on the values of each bit.
Arguments
Reads an unsigned 32 bit integer from the buffer and returns an array with true
/false
based on the values of each bit.
Arguments
Opens a file from the specified path and parses it.
Parameters
Closes the previously opened file. Should always be called once you are done parsing to avoid memory leaks.
Indicates that all subsequent reads and writes from the buffer / file should use big-endian byte order.
Indicates that all subsequent reads and writes from the buffer / file should use little-endian byte order.
Returns true if the buffer / file is being read in big-endian byte order, or false otherwise.
Returns true if the buffer / file is being read in little-endian byte order, or false otherwise.
Returns the size of the buffer / file in bytes.
Returns the physical disk location of the buffer.
Returns true if the current read position is at the end of the buffer.
Sets the current read position to the address offset
.
Moves the current read position ahead by offset bytes.
Returns the current read position of the buffer / file.
FAQs
A binary buffer parser with support for infinite sized files
We found that binary-buffer-parser 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.