Utilize any compression algorithm with just a single module...
npm install pulverized





```
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...
``
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 )pulverizedSettingsObjectExamples
Within all compression methods, the 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...
javascript
Pulverized["COMPRESS OR DECOMPRESS"]["ALGORITHM"].sync(
buffer / required /,
pulverizedSettingsObject / optional /
)
``javascript
fs.writeFileSync(
"./examples/lorem-sync-l9.txt.gz",
Pulverized.compress.gz.sync(
fs.readFileSync(loremFilename,"utf8"), {
level:9
}
)
);
`#### Async Examples
`javascript
Pulverized["COMPRESS OR DECOMPRESS"]["ALGORITHM"].async(
buffer / required /,
callback / required /,
pulverizedSettingsObject / optional /
)
``javascript
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
`javascript
Pulverized["COMPRESS OR DECOMPRESS"]["ALGORITHM"].stream(
pulverizedSettingsObject / optional /
)
``javascript
fs.createReadStream(loremFilename)
.pipe(Pulverized.compress.br.stream({
quality:1
}))
.pipe(fs.createWriteStream("./examples/lorem-stream-q1.txt.br"));
``