npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@phrohdoh/binary-buffer-parser

v1.0.0

Published

A simple buffer parser.

Downloads

15

Readme

binary-buffer-parser

A simple binary buffer parser.

Download

binary-buffer-parser is installable via:

  • GitHub git clone https://github.com/Pupix/binary-buffer-parser.git
  • npm: npm install binary-buffer-parser

Quick example

var BinaryParser = require('binary-buffer-parser'),
    buffer = new Buffer('Hello world!')
    parser = new BinaryParser(buffer);
        
    console.log(parser.int8()); // 72
    console.log(parser.uint32()); // 1869376613
    console.log(parser.stringView().join('')) // Hello World!

Methods

####Helper Methods

####Generic Methods

####Bitfield Methods

####View Methods


Documentation

Sets the endian format of the parser.

Parameters

  1. endian {string} The new endian format. Can be either little/LE for little endian or big/BE for big endian.

Returns the length of the buffer.

Sets the offset of the reading cursor at the passed position, starting from the beginning of the buffer.

  1. offset {number} The new value of the new offset position.

Advances the reading cursor by the passed offset from its current position.

  1. offset {number} The number of bytes to skip over.

Returns the position of the reading cursor inside the buffer.

Reads a signed 8 bit integer from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of int8 to read consecutively

Reads a unsigned 8 bit integer from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of uint8 to read consecutively

Reads a signed 16 bit integer from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of int16 to read consecutively

Reads a unsigned 16 bit integer from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of uint16 to read consecutively

Reads a signed 32 bit integer from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of int32 to read consecutively

Reads a unsigned 32 bit integer from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of uint32 to read consecutively

Reads a 32 bit float from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of floats to read consecutively

Reads a unsigned 64 bit double from the buffer. If length is passed, the same function will be ran multiple times and return the result as an array.

Parameters

  1. [length] {number} The number of doubles to read consecutively

Reads an ASCII string from the buffer.

Parameters

  1. length {number} The length of the string.

Reads a null terminated ASCII 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.

Reads an unsigned 16 bit integer from the buffer and returns an array with true/false based on the values of each bit.

Reads an unsigned 32 bit integer from the buffer and returns an array with true/false based on the values of each bit.

Returns the buffer in ASCII encoding inside an array, divided by character.

Returns the buffer in hexadecimal encoding inside an array, divided by byte.

Returns the buffer in ANSI encoding inside an array, divided by character.