How to use the Extract function from tar
Find comprehensive JavaScript tar.Extract code examples handpicked from public code repositorys.
GitHub: imlucas/lone
88 89 90 91 92 93 94 95 96 97
} debug('reading...', config.node.dest); input = fs.createReadStream(config.node.dest); ungzip = zlib.createGunzip(); extractor = tar.Extract({ path: config.cache }); extractor.on('end', function() {
4
49
4
6 7 8 9 10 11 12 13 14 15
* originpath 源路径 * destpath 目标路径 * cb 回调函数 */ function extract(originpath, destpath, cb) { const extractor = tar.Extract(destpath).on('error', err => cb(err)).on('end', () => { shell.rm(originpath) console.log('remove', originpath) cb() })
3
3
2
123 124 125 126 127 128 129 130 131 132
} createExtractor(mirrorPath, resolve, reject) { const validateStream = new (_crypto || _load_crypto()).HashStream(); const extractorStream = new (_stream || _load_stream()).UnpackStream(); const untarStream = tar.Extract({ path: this.dest, strip: 1 }); extractorStream.pipe(untarStream).on('error', reject).on('entry', entry => { if ((_constants || _load_constants()).ROOT_USER) { entry.props.uid = entry.uid = 0;
1
1
2
tar.extract is the most popular function in tar (215 examples)