0.0.3 • Published 6 years ago
jsonlz4-decompress v0.0.3
JSON lz4 Decompress
A Node.js module and CLI application for decompressing a Firefox bookmark backup jsonlz4 file format into JSON.
Node module
Installation
To install as a local module and include as a dependency:
npm install --save jsonlz4-decompressUsage
var jsonlz4 = require('jsonlz4-decompress');
var fs = require('fs');
// Open file into buffer
fs.readFile('/path/to/bookmarkbackups/back-up-date.jsonlz4', function(err, fileBuffer) {
  // decompress file buffer to JSON
  decompressedJson = jsonlz4(fileBuffer);
  // do something with the JSON
  console.log(decompressedJson);
});Commandline
Installation
To install as a command line application:
npm install jsonlz4-decompress -gYou may need to prefix the command with sudo.
Usage
  Usage: index [options] <file>
  Decompress a Firefox bookmark backup jsonlz4 file format into JSON.
  Options:
    -h, --help    output usage information
    -p, --pretty  Pretty print JSONOutput is sent to stdout
Technical stuff
Based on a description snippet found here
bytes 0-7: Magic number when converted to a string mozLz40 followed by a null charater.bytes 8-11: Uncompressed file size.  Little endian unsigned 32bit integer.bytes 12-EOL: LZ4 compressed blocked.