(resolve, reject, tarballPath)
| 64505 | } |
| 64506 | |
| 64507 | createExtractor(resolve, reject, tarballPath) { |
| 64508 | const integrityInfo = this._supportedIntegrity(); |
| 64509 | |
| 64510 | const now = new Date(); |
| 64511 | |
| 64512 | const fs = __webpack_require__(4); |
| 64513 | const patchedFs = Object.assign({}, fs, { |
| 64514 | utimes: (path, atime, mtime, cb) => { |
| 64515 | fs.stat(path, (err, stat) => { |
| 64516 | if (err) { |
| 64517 | cb(err); |
| 64518 | return; |
| 64519 | } |
| 64520 | if (stat.isDirectory()) { |
| 64521 | fs.utimes(path, atime, mtime, cb); |
| 64522 | return; |
| 64523 | } |
| 64524 | fs.open(path, 'a', (err, fd) => { |
| 64525 | if (err) { |
| 64526 | cb(err); |
| 64527 | return; |
| 64528 | } |
| 64529 | fs.futimes(fd, atime, mtime, err => { |
| 64530 | if (err) { |
| 64531 | fs.close(fd, () => cb(err)); |
| 64532 | } else { |
| 64533 | fs.close(fd, err => cb(err)); |
| 64534 | } |
| 64535 | }); |
| 64536 | }); |
| 64537 | }); |
| 64538 | } |
| 64539 | }); |
| 64540 | |
| 64541 | const validateStream = new ssri.integrityStream(integrityInfo); |
| 64542 | const untarStream = tarFs.extract(this.dest, { |
| 64543 | strip: 1, |
| 64544 | dmode: 0o755, // all dirs should be readable |
| 64545 | fmode: 0o644, // all files should be readable |
| 64546 | chown: false, // don't chown. just leave as it is |
| 64547 | map: header => { |
| 64548 | header.mtime = now; |
| 64549 | return header; |
| 64550 | }, |
| 64551 | fs: patchedFs |
| 64552 | }); |
| 64553 | const extractorStream = gunzip(); |
| 64554 | |
| 64555 | validateStream.once('error', err => { |
| 64556 | this.validateError = err; |
| 64557 | }); |
| 64558 | validateStream.once('integrity', sri => { |
| 64559 | this.validateIntegrity = sri; |
| 64560 | }); |
| 64561 | |
| 64562 | untarStream.on('error', err => { |
| 64563 | reject(new (_errors || _load_errors()).MessageError(this.config.reporter.lang('errorExtractingTarball', err.message, tarballPath))); |
| 64564 | }); |
no test coverage detected