How to use targz - 10 common examples

To help you get started, we’ve selected a few targz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / PowerBI-visuals-FacetKey / bin / downloadPrivateSubmodules.js View on Github external
downloadFile(info.dist.tarball, tarballPath, function (error) {
                            if (error) {
                                console.error(error);
                            } else {
                                const extract = targz.decompress({
                                    src: tarballPath,
                                    dest: tmpPath,
                                }, function(err) {
                                    if (err) {
                                        console.error(err);
                                    } else {
                                        try {
                                            fileTools.createFilePath(modulePath);
                                            mv(path.join(tmpPath, 'package'), modulePath, function (err) {
                                                if (err) {
                                                    console.error(err);
                                                }
                                            });
                                        }
                                        catch (err) {
                                            console.log(err);
github microsoft / PowerBI-visuals-StrippetsBrowser / bin / downloadPrivateSubmodules.js View on Github external
downloadFile(info.dist.tarball, tarballPath, function (error) {
                            if (error) {
                                console.error(error);
                            } else {
                                const extract = targz.decompress({
                                    src: tarballPath,
                                    dest: tmpPath,
                                }, function(err) {
                                    if (err) {
                                        console.error(err);
                                    } else {
                                        try {
                                            fileTools.createFilePath(modulePath);
                                            mv(path.join(tmpPath, 'package'), modulePath, function (err) {
                                                if (err) {
                                                    console.error(err);
                                                }
                                            });
                                        }
                                        catch (err) {
                                            console.log(err);
github microsoft / PowerBI-visuals-CardBrowser / bin / downloadPrivateSubmodules.js View on Github external
downloadFile(info.dist.tarball, tarballPath, function (error) {
                            if (error) {
                                console.error(error);
                            } else {
                                const extract = targz.decompress({
                                    src: tarballPath,
                                    dest: tmpPath,
                                }, function(err) {
                                    if (err) {
                                        console.error(err);
                                    } else {
                                        try {
                                            fileTools.createFilePath(modulePath);
                                            mv(path.join(tmpPath, 'package'), modulePath, function (err) {
                                                if (err) {
                                                    console.error(err);
                                                }
                                            });
                                        }
                                        catch (err) {
                                            console.log(err);
github simatec / ioBroker.backitup / lib / restore / redis.js View on Github external
}, 10000);

    let name;
    let pth;
    if (!fs.existsSync(options.path)) {
        const parts = options.path.replace(/\\/g, '/').split('/');
        name = parts.pop();
        if (name.indexOf('.')) {
            pth = parts.join('/');
        }
    } else {
        pth = options.path;
    }

    try {
        targz.decompress({
            src: fileName,
            dest: tmpDir,
        }, (err, stdout, stderr) => {

            clearInterval(timer);

            if (err) {
                log.error(err);
                if (callback) {
                    callback(err, stderr);
                    callback = null;
                }
            } else {
                try {
                    let files = [];
                    if( fs.existsSync(tmpDir) ) {
github simatec / ioBroker.backitup / lib / restore / historyDB.js View on Github external
function restore(options, fileName, log, callback) {
    let timer = setInterval(() => {
        if (fs.existsSync(options.path))  {
            log.debug('Extracting...');
        } else {
            log.debug('Something is wrong. No file found.');
        }
    }, 10000);

    try {
        targz.decompress({
            src: fileName,
            dest: options.path,
        }, (err, stdout, stderr) => {

            clearInterval(timer);

            if (err) {
                log.error(err);
                if (callback) {
                    callback(err, stderr);
                    callback = null;
                }
            } else {
                if (callback) {
                    callback(null, 'historyDB restore done');
                    callback = null;
github simatec / ioBroker.backitup / lib / restore / total.js View on Github external
function restore(options, fileName, log, callback) {
    let timer = setInterval(() => {
        if (fs.existsSync(options.dir))  {
            log.debug('Extracting...');
        } else {
            log.debug('Something is wrong. No file found.');
        }
    }, 10000);

    try {
        targz.decompress({
            src: fileName,
            dest: options.dir,
        }, (err, stdout, stderr) => {

            clearInterval(timer);

            if (err) {
                log.error(stderr);
                if (callback) {
                    callback(err, stderr);
                    callback = null;
                }
            } else {
                if (callback) {
                    callback(null, stdout);
                    callback = null;
github simatec / ioBroker.backitup / lib / restore / zigbee.js View on Github external
} else {
        fs.mkdirSync(options.path + '/zigbee_' + num[0]);
    }

    let timer = setInterval(() => {
        if (fs.existsSync(options.path + '/zigbee_' + num[0]))  {
            log.debug('Extracting Zigbee Backupfile...');
        } else {
            log.debug('Something is wrong. No file found.');
        }
    }, 5000);

    let pth = options.path + '/zigbee_' + num[0];

    try {
        targz.decompress({
            src: fileName,
            dest: pth,
        }, (err, stdout, stderr) => {

            clearInterval(timer);

            if (err) {
                log.error('Zigbee Restore not completed');
                log.error(stderr);
                if (callback) {
                    callback(err, stderr);
                    callback = null;
                }
            } else {
                if (callback) {
                    log.debug('Zigbee Restore completed successfully');
github simatec / ioBroker.backitup / lib / restore / mysql.js View on Github external
function restore(options, fileName, log, callback) {
    const fileNameMysql = path.join(options.backupDir , `mysql_restore_backupiobroker.sql`);
    log.debug('Start mysql Restore ...');
    let timer = setInterval(() => {
        if (fs.existsSync(fileNameMysql))  {
            const stats = fs.statSync(fileNameMysql);
            const fileSize = Math.floor(stats.size / (1024 * 1024));
            log.debug(`Extract mysql Backupfile ${fileSize}MB so far...`);
        } else {
            log.debug(`Something is wrong with "${fileNameMysql}".`);
        }
    }, 10000);

    try {
        targz.decompress({
            src: fileName,
            dest: options.backupDir,
            tar: {
                map: header => {
                    header.name = `mysql_restore_backupiobroker.sql`;
                    return header;
                }
            }
        }, (err, stdout, stderr) => {

            clearInterval(timer);

            if (err) {
                log.error(err);
                if (callback) {
                    log.error('mysql Restore not completed');
github facebook / react / scripts / rollup / utils.js View on Github external
return new Promise((resolve, reject) =>
    targz.decompress(options, error => {
      if (error) {
        reject(error);
        return;
      }
      resolve();
    })
  );
github webiny / webiny-js / scripts / utils / packaging.js View on Github external
return new Promise((resolve, reject) =>
        targz.decompress(options, error => {
            if (error) {
                reject(error);
                return;
            }
            resolve();
        })
    );

targz

TarGz for NodeJS

MIT
Latest version published 9 years ago

Package Health Score

47 / 100
Full package analysis

Popular targz functions