JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q39046F
  • License MIT

Library to pack/unpack binary data

Package Exports

  • jspack.ts
  • jspack.ts/dist/main.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jspack.ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JsPack.ts

JsPack.ts - Library to pack/unpack binary data

Library to pack/unpack binary data

JsPack is a library for working with binary data in JavaScript using the Uint8Array object. To ensure maximum stability, this library has 100% test coverage. The library was created using typescript for more convenient work with many types.


Installation

Install with npm:

npm i jspack.ts

Formats

Key Length Type Description
A any number[] Array
x 1 number NUL-padded byte
c 1 string Single char (ascii)
s any string String char (ascii)
b 1 number Char (signed)
B 1 number Char (unsigned)
h 2 number Short (signed)
H 2 number Short (unsigned)
i 4 number Int (signed)
I 4 number Int (unsigned)
l 4 number Long (signed)
L 4 number Long (unsigned)
q 8 number Long long (signed)
Q 8 number Long long (unsigned)
f 4 number¹ Float
d 8 number¹ Double

Superscripts:

1: Unpack with 'f' and 'd' key can return NaN. The value NAN is used to represent a value that is an error. This is represented when exponent field is all ones with a zero sign bit or a mantissa that it not 1 followed by zeros. This is a special value that might be used to denote a variable that doesn’t yet hold a value.

Endianness

Key Description
< Little endian
> Big endian
! Network (big endian)