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 🙏

© 2026 – Pkg Stats / Ryan Hefner

json-bufferify

v0.2.3

Published

This is a tiny module to help you convert between JSON data and ArrayBuffer, and you can use it in both Node.js and browsers.

Readme

json-bufferify npm GitHub file size in bytes

This is a tiny module to help you convert between JSON data and ArrayBuffer, and you can use it in both Node.js and browsers.

Features

  • Convert JSON data to ArrayBuffer.
  • Revert JSON data from ArrayBuffer.

Installation

npm install json-bufferify

Usage

Step 0 - Import json-bufferify.

In Node.js

// CommonJS
const bufferify = require('json-bufferify');

// ES6 Modules
import bufferify from 'json-bufferify';

In browsers

<script src="json-bufferify.js"></script>

In TypeScript

// Traditional style
import bufferify = require('json-bufferify');

// ES6 Modules
import bufferify from 'json-bufferify';

In Egret

Open "egretProperties.json" and Add the following code to "modules" node.

{
    "name": "json-bufferify",
    "path": "D:/Work/modules/json-bufferify"
}

Step 1 - Convert JSON data to ArrayBuffer and send via WebSocket.

let ws = new WebSocket(url);
ws.binaryType = 'arraybuffer';
ws.send(bufferify.encode(0, {
    sex: 0,
    name: 'Bob',
    age: 25
}));

Step 2 - Revert JSON data from ArrayBuffer.

ws.on('message', data => {
    console.log(bufferify.decode(0, {
        name: 'string',
        sex: 'number',
        age: 'number'
    }, data));
});

APIs

bufferify.encode(offset, data)

Convert JSON data to ArrayBuffer and return the DataView.

  • offset - The start point of the DataView where to store the data.
  • data - The JSON data.

bufferify.decode(offset, template, source)

Revert JSON data from ArrayBuffer and return it.

  • offset - The start point of the DataView where to read the data.
  • template - The template of the JSON data.
  • source - The ArrayBuffer, or the Buffer in Node.js, or the DataView of the ArrayBuffer.

Examples

Convert/Revert an array.

let ws = new WebSocket(url);
ws.binaryType = 'arraybuffer';
ws.send(bufferify.encode(0, [1, 2, 3, 4, 5, 6, 7, 8, 9]));
ws.on('message', data => {
    console.log(bufferify.decode(0, ['number'], data));
});

Convert/Revert a complex Object.

let ws = new WebSocket(url);
ws.binaryType = 'arraybuffer';
ws.send(bufferify.encode(0, {
    obj: {
        opcode: 8,
        info: 'Hello'
    },
    arr: [1, 2, 3, 4, 5],
    list: [{
        name: 'Jerry',
        id: '536598'
    },
    {
        name: 'Tom',
        id: '85947'
    },
    {
        id: '459823',
        name: 'Kevin'
    }]
}));
ws.on('message', data => {
    console.log(bufferify.decode(0, {
        arr: ['number'],
        obj: {
            opcode: 'number',
            info: 'string'
        },
        list: [{
            id: 'string',
            name: 'string'
        }]
    }, data));
});

Compatibility

  • The latest LTS version of Node.js.
  • Modern browsers such as Chrome, Firefox, Edge(Chromium-based), Safari.

License NPM

This is licensed under the GNU LGPL, version 3 or later.