1.5.1 • Published 4 months ago

bufferstuff v1.5.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

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/ultrakillMP_server

Projects similar to bufferStuff

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

1.5.1

4 months ago

1.5.0

4 months ago

1.3.4

7 months ago

1.4.2

6 months ago

1.3.3

7 months ago

1.4.1

6 months ago

1.3.2

7 months ago

1.4.0

6 months ago

1.3.1

7 months ago

1.3.0

11 months ago

1.2.0

12 months ago

1.2.1

12 months ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago