npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lzg

v2.0.0

Published

LZG compression, liblzg LZ77 based minimalist lossless data command line compressor and Node.js library

Downloads

34

Readme

LZG Compression

license NPM version Libraries.io dependency status for GitHub repo

lzg is library and command line tool to compress and decompress files and streams using LZG compression algorithm

LZG algorithm is a minimal implementation of an LZ77 class compression. The main characteristic of the algorithm is that the decoding routine is very simple, fast, and requires no memory.

In general, lzg does not compress as well as zlib, for instance. On the other hand the decoder is very simple and very fast - ideal for systems with tight memory limits or limited processing capabilities, including in-browser by pure JavaScript.

Compressed files can be easily decompresed in-browser with very low-footprint lzgmini decompressor: https://github.com/mbitsnbites/liblzg/tree/master/src/extra/lzgmini.js

This Node.JS module is based on original C implementation of liblzg (ver. 1.0.10) by Marcus Geelnard

Setup as command line tool

  • install Node.JS (if not already installed)
  • from command line execute:
$ npm install -g lzg

Usage

Compression

$ lzg [options] <originalFile> <compressedFile>

Decompression

$ lzg -d <compressedFile> <decompressedFile>

For full list of supported options execute:

$ lzg -h

Options

All options are optional. When not specified, they are ignored or have default value. Boolean options are true if flag is present, false otherwise.

| Option | Type | Default value | | ------------------------------------------ | :--------------: | ------------- | | -d, --decompress | Boolean | false | | -l, --level | Integer [1..9] | 9 | | -v, --verbose | Boolean | false | | -h, --help | Boolean | | -V, --version | Boolean |

Option decompress

When this flag is given, tool decompress input file otherwise (by default, without flag) tool compresses input file to output file.

Option level

Specifies compression level, integer between 1 and 9 1 is the fastest but weakest and 9 is the best but slowest

Option verbose

When given, additional debug information are displayed on console

Option help

Displays all options with short description.

Option version

Displays version of application (match NPM/Git version number).

Testing

$ npm test

Using as library in Node.JS

.compressFileAsync(inputFilePath, outputFilePath, compressionlevel = 9, verbose = false)

compress specified input file to output file

var lzg = require("lzg");
await lzg.compressFileAsync("big.txt", "copressed.lzg", 9, true);

.decompressFileAsync(inputFilePath, outputFilePath, verbose = false)

decompress specified lzg file to original output file

var lzg = require("lzg");
await lzg.decompressFileAsync("copressed.lzg", "original.txt", true);

.compressAsync(sourceRawBuffer, compressionlevel = 9, verbose = false)

returns compressed Node.JS buffer object

.decompressAsync(sourceCompressedBuffer, verbose = false)

returns decompressed Node.JS buffer object

Rebuilding liblzg from C sources

First, install and configure Emscripten from http://emscripten.org/ On Windows, use WSL2 to build

Then run command:

$ npm run build

or build it directly:

$ cd ./vendor
$ emmake make clean install

Version history

2.0.0 2022-02-04

  • upgraded for most recent version od emscripten
  • upgraded liblzg
  • converted to async

1.0.0 2016-12-07

  • initial release

Acknowledgements

This project is port of original C implementation of liblzg

Copyright (c) 2010-2022 Marcus Geelnard http://liblzg.bitsnbites.eu/ https://github.com/mbitsnbites/liblzg

Transpiled to JavaScript using Emscripten

For compression test using text of Moby Dick by Herman Melville