Swift-Cardinal Object Notation (SCON)
A minimal node module allowing the reading and writing of data in the SCON format. The SCON format, created by Aritz J Beobide-Cardinal (ARitz Cracker) and James R Swift, is an extendable binary file format that was created to store data more efficiently than the popular JSON standard.
npm install scon --save
var useMagicNumber = true; //If useMagicNumber is undefined or null, it will default to true;var scon = ;// If you wish to encode binary data, use NodeJS Buffers or Uint8Arraysvar encoded = scon;// encoded will be a Buffer or Uint8Array depending on the platform you're using it on.var decoded = scon;// SCON also now supports "Stream decoding". These are intended for use where you get a stream of never-ending scon data.// scon.streamDecode returns a function which expects a chunk of data (Uint8Array, Buffer, or String with characters no higher than 255)// For example:readableStream;// It is important to note if the chunk contains multiple complete SCONs, the callback will be called IN SYNC, this is to make sure that the entire chunk is read before the next one arrives.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.
- Switched to NodeJS buffer functions for optimization, but falls back to Uint8Arrays for cross-platform use
- Added scon.streamDecode
- Now uses Uint8Array instead of NodeJS Buffer for browser support
- booleans are now stored more efficiently
- infinity/negative-infinity values are now stored more efficiently
- keys no longer take up an unnecessary byte.
- 0 values will now no-longer take up unnecessary space.
- scon.partialDecode added which allows for decoding partial scon files, documentation soon!
1.1.0 Ints now take up less bytes depending on how big they are. Also, bugfixes.
1.0.3 Added TravisCI intergration and tests
1.0.2 Added support for NaN and 64 bit floats
1.0.0 Added support for arrays, booleans, and nulls!
0.9.0 Major update in module structure, and added error handling.
0.8.2 Removed left over tests.
0.8.0 Initial release