Archiver ![Build Status](https://secure.travis-ci.org/ctalkington/node-archiver.png?branch=master)
Creates Archives (ZIP, TAR) via Node Streams. Depends on Node's build-in zlib module for compression available since version 0.6.3.
Install
npm install archiver --save
You can also use npm install https://github.com/ctalkington/node-archiver/archive/master.tar.gz
to test upcoming versions.
API
addFile(inputStream, data, callback)
Adds a file to the Archiver stream.
finalize(callback(written))
Finalizes the Archiver stream. When everything is done, callback is called with the total number of bytes in the archive.
Zip
Methods
createZip(options)
Creates an Archiver ZIP object.
Options
Sets zip comment.
forceUTC boolean
If true, forces file date and time to UTC. Helps with testing across timezones.
zlib object
Passed to node's zlib module to control compression. Options may vary by node version.
File Data
name string
required
Sets file name.
date string
Sets file date.
store boolean
If true, zip contents will be stored without compression.
Sets file comment.
Tar (beta)
Methods
createTar(options)
Creates an Archiver Tar object. in testing
Options
recordsPerBlock number
Sets number of records in a block, default is 20 (for advanced users only).
File Data
name string
required
Sets file name.
date string
Sets file date.
Examples
Here are a few examples to get you started.
Take a peek at the examples folder for a complete listing.
Contributing
see CONTRIBUTING
Changelog
see CHANGELOG
Credits
Originally inspired by Antoine van Wel's node-zipstream.