A set of utility classes for reading and writing binary data in NodeJS.
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Holly 6d0660827b
All checks were successful
Check for outdated dependencies / build (25.x) (push) Successful in 3m9s
Build for Browser / build (25.x) (push) Successful in 5m6s
Build for NodeJS / build (25.x) (push) Successful in 5m7s
Bump Dependencies.
2026-02-06 20:00:39 +00:00
.github/workflows Intentionally downgrade package to test outdated check. 2026-02-01 00:54:18 +00:00
.idea add configs 2026-01-31 23:49:09 +00:00
base Upgrade deps, cleanup codebase, make web builds less terrible (they're still terrible), add vectors, add null terminated string. 2026-01-31 20:24:29 +00:00
readers Upgrade deps, cleanup codebase, make web builds less terrible (they're still terrible), add vectors, add null terminated string. 2026-01-31 20:24:29 +00:00
tooling Release v1.9.2 - Expose interfaces once again. 2026-02-01 00:35:45 +00:00
writers Release v1.9.1 - Add missing cstring write method + add vector write to interface. 2026-01-31 21:01:36 +00:00
.gitignore janky tooling to get this working properly 2023-06-22 11:32:40 +01:00
.npmignore Release v1.9.1 - Add missing cstring write method + add vector write to interface. 2026-01-31 21:01:36 +00:00
index.ts Upgrade deps, cleanup codebase, make web builds less terrible (they're still terrible), add vectors, add null terminated string. 2026-01-31 20:24:29 +00:00
LICENSE Release v1.9.0 2026-01-31 20:44:45 +00:00
package-lock.json Bump Dependencies. 2026-02-06 20:00:39 +00:00
package.json Bump Dependencies. 2026-02-06 20:00:39 +00:00
README.md remove ultrakillMP_server 2024-12-16 10:35:46 +00:00
tsconfig.json Upgrade deps, cleanup codebase, make web builds less terrible (they're still terrible), add vectors, add null terminated string. 2026-01-31 20:24:29 +00:00

bufferStuff   CodeFactor   Node.js CI   npm

A set of utility classes for reading and writing binary data in NodeJS.

Motivations

I tend to write code a lot that needs to read and write from buffers and this is sometimes in big-endian too, so I decided eventually to make a utility to help me with that which is what you see here. Originally I had two variants of bufferStuff that were for LE and BE respectively but this got difficult to manage so I rewrote it in TypeScript and added support for both reader / writer types.

Usage

You can create an instance of the Reader and Writer classes like this:

// You *must* be expicit with the endianness
const leReader:IReader = createReader(Endian.LE, buffer);
const beReader:IReader = createReader(Endian.BE, buffer);

// Size is optional, will dynamically allocate if left empty or 0
const leWriter:IWriter = createWriter(Endian.LE, <optional: size>);
const beWriter:IWriter = createWriter(Endian.BE, <optional: size>);

I tried to keep it as simple as possible to use, for example if you want to write a (signed) byte you do as follows:

writer.writeByte(<number>);

You can find a list of all of the methods for Writers and Readers in their interface files.

Projects using bufferStuff

If your project uses bufferStuff feel free to make a PR to add it to this list!

tgpholly/mc-beta-server

tgpholly/t00-multiuser

Projects similar to bufferStuff

tgpholly/csharp-extensions/BinaryTools - Basically bufferStuff but for C#