Created
July 25, 2017 20:57
-
-
Save isaacs/cd54aa2f1d87362c689b4fda7b659d41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const tar = require('./') | |
const fs = require('fs') | |
const rimraf = require('rimraf') | |
const mkdirp = require('mkdirp') | |
rimraf.sync('input') | |
rimraf.sync('output') | |
mkdirp.sync('input/foo') | |
mkdirp.sync('output/foo') | |
fs.writeFileSync('input/foo/bar', 'this is bar\n') | |
tar.c({ file: 'foo.tgz', gzip: true, sync: true, C: 'input' }, ['foo']) | |
tar.x({ file: 'foo.tgz', sync: true, C: 'output', onentry: entry => { | |
if (entry.path === 'foo/bar') | |
entry.path = 'foo/xyz' | |
}}) |
Author
isaacs
commented
Jul 25, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment