lib/utils/compression.js
function(sourceFile, destDir) {
        return new Promise(function(resolve, reject) {
            // expand
            var tempFile = sourceFile + '.tmp.tar';
            try {
                var data = new Buffer(fs.readFileSync(sourceFile));
                var expanded = Bzip2.decompressFile(data);
                fs.writeFileSync(tempFile, new Buffer(expanded));
                resolve(tempFile);
            } catch(err) {
                reject(err);
            }
        }).then(function(tempFile) {
            // un-pack
            return new Promise(function(resolve, reject) {
                try {
                    var rs = fs.createReadStream(tempFile);
                    rs.pipe(tar.extract(destDir).on('finish', function() {
                        rimraf.sync(tempFile);
                        resolve(destDir);
                    }));
                } catch (err) {
                    rimraf.sync(tempFile);
                    reject(err);
                }
            });
        });
    }
function(sourceFile, destDir) {
        return new Promise(function(resolve, reject) {
            // expand
            var tempFile = sourceFile + '.tmp.tar';
            try {
                var data = new Buffer(fs.readFileSync(sourceFile));
                var expanded = Bzip2.decompressFile(data);
                fs.writeFileSync(tempFile, new Buffer(expanded));
                resolve(tempFile);
            } catch(err) {
                reject(err);
            }
        }).then(function(tempFile) {
            // un-pack
            return new Promise(function(resolve, reject) {
                try {
                    var rs = fs.createReadStream(tempFile);
                    rs.pipe(tar.extract(destDir).on('finish', function() {
                        rimraf.sync(tempFile);
                        resolve(destDir);
                    }));
                } catch (err) {
                    rimraf.sync(tempFile);
                    reject(err);
                }
            });
        });
    }
Extracts a tar to a directory.

@param sourceFile {string}
@param destDir {string}
@returns {Promise.<string>} path to the destination