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

pulverized

v1.3.1

Published

Utilize any compression algorithm with just a single module...

Downloads

56

Readme

License Version Weekly Downloads Issues Open CircleCi Build Snyk Vulnerabilities

Pulverized

Utilize any compression algorithm with just a single module... The compression methods that are taken care of as of now are gzip, deflate and brotli.. if any new cool methods become mainstream, we will do our best to include them...

Notes

Any version below 1.3 works using the iltorb npm module which is ideal for any node version below 11... Versions 1.3 and above use node's native zlib brotli methods and are ideal with Node.js version 11 (and above)... There is a thrown error when you attempt to use the latest version but aren't in an ideal environment to do such...

Install

Like we need to tell you but run this...

npm install pulverized

And then you can start using the module by doing the below...

var Pulverized = require('pulverized');

Lastly, you can understand the methods and signatures of those methods if you read the below section...

Methods

This is the Pulverized singleton 'illustrated' as a tree...

Pulverized
|-- compress
|   |-- async
|   |   |-- br ( dataToCompress, callback, brotliSettingsObject )
|   |   |-- df ( dataToCompress, callback, deflateSettingsObject )
|   |   \-- gz ( dataToCompress, callback, gzipSettingsObject )
|   |
|   |-- stream
|   |   |-- br ( brotliSettingsObject )
|   |   |-- df ( deflateSettingsObject )
|   |   \-- gz ( gzipSettingsObject )
|   |
|   \-- sync
|       |-- br ( dataToCompress, brotliSettingsObject )
|       |-- df ( dataToCompress, deflateSettingsObject )
|       \-- gz ( dataToCompress, gzipSettingsObject )
|
\-- decompress
    |-- async
    |   |-- br ( dataToDecompress, callback )
    |   |-- df ( dataToDecompress, callback )
    |   \-- gz ( dataToDecompress, callback )
    |
    |-- stream
    |   |-- br ( )
    |   |-- df ( )
    |   \-- gz ( )
    |
    \-- sync
        |-- br ( dataToDecompress )
        |-- df ( dataToDecompress )
        \-- gz ( dataToDecompress )

Examples

Within all compression methods, the pulverizedSettingsObject uses the encoding parameters of the relevant algorithm deflate, gzip or brotli within the object.

The below pretty much points out what is in the examples folder... so I have each example from below in those files and more...

Compress Methods

Sync Examples

Pulverized["COMPRESS OR DECOMPRESS"]["ALGORITHM"].sync(
    buffer /* required */, 
    pulverizedSettingsObject /* optional */
)
fs.writeFileSync(
	"./examples/lorem-sync-l9.txt.gz",
	Pulverized.compress.gz.sync(
		fs.readFileSync(loremFilename,"utf8"), {
			level:9
		}
	)
);

Async Examples

Pulverized["COMPRESS OR DECOMPRESS"]["ALGORITHM"].async(
    buffer /* required */, 
    callback /* required */, 
    pulverizedSettingsObject /* optional */
)
Pulverized.compress.df.async(
	fs.readFileSync(loremFilename,"utf8"),
	function(err, output){
		fs.writeFileSync(
			"./examples/lorem-async-l5.txt.df",
			output
		);
		
		console.log(
			"df decompressed async setup",
			Pulverized.decompress.df.async(
				fs.readFileSync(
					"./examples/lorem-async-l5.txt.df"
				), function(err, output){
					console.log(
						"df decompressed output",
						err,
						output
					)
				}
			)
		);
	},{
		level:5
	}
)

Stream Examples

Pulverized["COMPRESS OR DECOMPRESS"]["ALGORITHM"].stream(
    pulverizedSettingsObject /* optional */
)
fs.createReadStream(loremFilename)
	.pipe(Pulverized.compress.br.stream({
		quality:1
	}))
	.pipe(fs.createWriteStream("./examples/lorem-stream-q1.txt.br"));