How to use the Extract function from tar

Find comprehensive JavaScript tar.Extract code examples handpicked from public code repositorys.

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() {
fork icon4
star icon49
watch icon4

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()
  })
fork icon3
star icon3
watch icon2

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;
fork icon1
star icon1
watch icon2