Natural Performance Manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

jsbindat

0.9.6 • Public • Published

JS Binary Data

Binary data serializer and unserializer for Node.js.

Beta.

Serialize and unserialize any Javascript data.

Supports:

  • All Javascript basic types: undefined, null, boolean, number, string, array and object
  • ES6 Set and Map
  • Relational data & circular references: no object duplication, the output structure is the same than the input was
  • Prototype chain is supported (require the 'prototypeChain' serializer option)
  • Instance of non-trivial object are supported, if a map of names to prototype/constructor is provided (require the 'classMap' option to be set to a common object/map on both the serializer and unserializer)

Serializing to a file example

var stream = fs.createWriteStream( 'path/to/my/file.jsdat' ) ;
await jsbindat.serialize( stream , data ) ;

... or just:

await jsbindat.writeFile( 'path/to/my/file.jsdat' , data ) ;

Unserializing from a file example

var stream = fs.createReadStream( 'path/to/my/file.jsdat' ) ;
var data = await jsbindat.unserialize( stream ) ;
stream.close() ;
// Do something with the data

... or just:

var data = jsbindat.readFile( 'path/to/my/file.jsdat' ) ;

Non-trivial object

TODO: documentation

install

npm i jsbindat

Downloadsweekly downloads

62

version

0.9.6

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar