baltar
A few small utilities for working with tarballs and http. Because you need tarballs over HTTP like:
Usage
Fetch & send tarballs over the network
baltar.pull(opts, callback)
Makes a request to opts.url
and unpacks it to opts.path
. baltar.pull
is the only method which accepts a callback so that it pass back all of the entries from the tar.Extract
stream. The end of pipechain is also returned for future stream operations (if desired).
opts.url
: {string} Location of the receiver.opts.headers
: {Object} HTTP headers to send.opts.method
: {string} HTTP Method to send.opts.path
: {string} Directory or file to unpack to.opts.tarball
: {string} Optional Path to save tarball to.returns
: {tar.Extract} Extraction stream for the pulled tarball.
baltar;
baltar.push(opts)
Pushes a tarball created from opts.path
to opts.url
optionally accepting a opts.method
and returns a stream
that represents the response.
opts.path
: Directory or file to packopts.ignoreFiles
: Extra ignore files to parseopts.url
: {string} Location of the receiver.opts.headers
: {Object} HTTP headers to send.opts.method
: {string} HTTP Method to send.returns
: {hyperquest} HTTP request stream toopts.url
.
baltar;
The stream returned is an instance of hyperquest
, so you can perform any additional stream operations on it.
Pack and unpack tarballs locally
baltar.unpack(opts)
Returns a stream which will unpack and stream into the specified opts.path
.
opts
: {Object|string} Options for unpacking tarball.opts.path
: Directory or file to unpack toreturns
: {Stream} Gunzip and untar pipechain toopts.path
.
fs;
baltar.pack(opts)
Returns a stream representing the tar.gz packed version of opts.dir
.
opts
: {Object|string} Options for packing tarball.opts.path
: Directory or file to pack.opts.ignoreFiles
: Extra ignore files to parse.
baltar