JSPM

lzfjs

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1540
  • Score
    100M100P100Q107316F
  • License BSD-2-Clause

LZF compression/decompression in pure JS

Package Exports

  • lzfjs

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 (lzfjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lzfjs

Compress and decompress data using LZF with no native dependencies. Naively ported directly from liblzf, specfically lzf_c.c and lzf_d.c by Marc Alexander Lehmann. If pure JS is not important to you, use the lzf npm package.

This module can be used in a browser or in Node.

License

BSD 2 Clause

Compress data

var lzf = require('lzfjs');
var data = new Buffer('Hello world');
console.log(lzf.compress(data).toString('base64')); // "CkhlbGxvIHdvcmxk"

Decompress data

var lzf = require('lzfjs');
var data = new Buffer('CkhlbGxvIHdvcmxk', 'base64');
console.log(lzf.decompress(data).toString('utf8')); // "Hello world"

Use in browser

Instead of passing a node Buffer to compress and decompress, pass in a TypedArray like a Uint8Array, or pass in an ArrayBuffer. The functions will return a Uint8Array.