@typescord/ftee
TypeScript icon, indicating that this package has built-in type declarations

0.9.1 • Public • Published

Ftee (Format Term External Erlang)

Ftee is a fast encoder and decoder for the Erlang External Term Format (version 131) written in TypeScript.

Note: the decoder does not check the lists' tail marker. If this is inconvenient, feel free to make an issue/PR.

Supported terms

  • Atoms (decode-only)
  • Booleans
  • Strings
  • Floats
  • Integers
  • Larges and smalls bigs
  • Map (objects)
  • Arrays
  • Tuples (decode-only)
  • "Strings" (via Buffer, larges buffers are encoded as lists.)

How to encode

const ftee = require('@typescord/ftee');

const packed = ftee.encode({ a: true, list: ['of', 3, 'things', 'to', 'pack'] });
console.log(packed);

How to decode

Note: LARGE_BIG_EXT or SMALL_BIG_EXT are decoded as strings (instead of bigints).

const ftee = require('@typescord/ftee');

const packed = Buffer.from('\u0083\u006d\u0000\u0000\u0000\u000bHello world', 'binary');
try {
	const unpacked = ftee.decode(packed);
	console.log(unpacked);
} catch (error) {
	console.error(error);
}

Package Sidebar

Install

npm i @typescord/ftee

Weekly Downloads

3

Version

0.9.1

License

MIT

Unpacked Size

21.4 kB

Total Files

12

Last publish

Collaborators

  • mestery
  • enderdragonneau