Giter Club home page Giter Club logo

node-archiver's Introduction

Archiver v0.4.3 Build Status

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.

Core

Methods

Archiver(type, options)

Convenience alias for create.

create(type, options)

Creates an Archiver instance based on the type (ie zip/tar) passed.

Instance Methods

addFile(input, data, callback(err))

Alias of append for compatibility that will be removed down the road.

append(input, data, callback(err))

Appends a file to the instance. Input can be in the form of a text string, buffer, or stream. When the instance has received, processed, and emitted the input, the callback is fired.

finalize(callback(err, bytesWritten))

Finalizes the instance. When the instance's stream has finished emitting, the callback is fired.

Zip

Options

comment string

Sets the zip comment.

forceUTC boolean

If true, forces the 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 the file name including internal path.

date string|Date

Sets the file date. This can be any valid date string or object. Defaults to current time in locale.

store boolean

If true, file contents will be stored without compression.

comment string

Sets the file comment.

Tar

Options

recordSize number

Sets the size (in bytes) of each record in a block, default is 512 (for advanced users only).

recordsPerBlock number

Sets the number of records in a block, default is 20 (for advanced users only).

File Data

name string required

Sets the file name including internal path.

date string|Date

Sets the file date. This can be any valid date string or object. Defaults to current time in locale.

Examples

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.

Licensing

This project's code is licensed under the MIT license. see LICENSE-MIT.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.