@createlumina/bytebuffer
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

ByteBuffer Module

Version made for Lumina projects. Original credits goes to Voxelum/minecraft-launcher-core-node

npm version Downloads Install size npm Build Status

Provide some functions to query Minecraft server status. Port from bytebuffer.js.

Usage

Should similar to the bytebuffer in java.

You can also reference the bytebuffer.js.

There are sevearl notable differences:

  • Remove string methods as nodejs have better string encoding/decoding support.
  • This module only release one version using DataView. Should compatible for both browser and nodejs.
  • This module use BigInt to represent the long type.
  • Split non-common methods support into separate files. (Hope to reduce the build size)
  • Support esm (mjs)

Common usage:

import { ByteBuffer } from '@createlumina/bytebuffer';
const bb = ByteBuffer.allocate(10);
// similar to java's ByteBuffer

Using extra methods:

import { ByteBuffer } from '@createlumina/bytebuffer';
import '@createlumina/bytebuffer/varint64'; // importing this will inject the varint64 methods to ByteBuffer

const bb = ByteBuffer.allocate(10);
bb.writeVarint64(BigInt(1234567890)); // now this is avaiable!

Package Sidebar

Install

npm i @createlumina/bytebuffer

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

491 kB

Total Files

35

Last publish

Collaborators

  • padowyt2