Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: isaacs/node-tar
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 523c5c7fef48b10811fccd12b42803c61b6aead8
Choose a base ref
...
head repository: isaacs/node-tar
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3e35515c09da615ac268254bed85fe43ee71e2f0
Choose a head ref

Commits on Oct 8, 2015

  1. package: fix repository link

    iarna committed Oct 8, 2015
    Copy the full SHA
    51b6627 View commit details

Commits on Mar 27, 2017

  1. Copy the full SHA
    cb9f56e View commit details
  2. Copy the full SHA
    b0ec7cb View commit details
  3. minipass@1.0.2

    isaacs committed Mar 27, 2017
    Copy the full SHA
    c83b0ef View commit details
  4. the new parser

    isaacs committed Mar 27, 2017
    Copy the full SHA
    9594f82 View commit details
  5. wip

    isaacs committed Mar 27, 2017
    Copy the full SHA
    7713bee View commit details
  6. Copy the full SHA
    f433777 View commit details
  7. move Entry into its own module

    isaacs committed Mar 27, 2017
    Copy the full SHA
    0e5d165 View commit details
  8. rewrite header as class, organize field management

    This removes a lot of tar.fieldOffs[tar.fields[fieldName]] business.
    
    There's an internal Field class which knows its beginning and end, and
    can read a value from a buffer, or write it back to a buffer.
    isaacs committed Mar 27, 2017
    Copy the full SHA
    f0d0f36 View commit details
  9. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    d01de33 View commit details

Commits on Mar 30, 2017

  1. remove out of date tests

    isaacs committed Mar 30, 2017
    Copy the full SHA
    daff038 View commit details
  2. handle prefixes properly

    isaacs committed Mar 30, 2017
    Copy the full SHA
    d2d0625 View commit details
  3. Copy the full SHA
    849caaf View commit details
  4. Copy the full SHA
    e27960a View commit details
  5. Copy the full SHA
    a3ae7bc View commit details

Commits on Mar 31, 2017

  1. Copy the full SHA
    5d7c6d7 View commit details
  2. removing more legacy stuff

    isaacs committed Mar 31, 2017
    Copy the full SHA
    286c271 View commit details
  3. remove unused symbol in pax.js

    isaacs committed Mar 31, 2017
    Copy the full SHA
    2c498c2 View commit details
  4. Copy the full SHA
    1510cfc View commit details
  5. Remove 'realtime' and 'security' PAX fields

    They were 'reserved for a future specification' 3 decades ago and never used.
    isaacs committed Mar 31, 2017
    Copy the full SHA
    c66f97c View commit details
  6. an entry writer class

    isaacs committed Mar 31, 2017
    Copy the full SHA
    fed5179 View commit details

Commits on Apr 3, 2017

  1. Copy the full SHA
    7e39919 View commit details
  2. Add a WriteEntrySync class

    isaacs committed Apr 3, 2017
    Copy the full SHA
    d736ae8 View commit details

Commits on Apr 4, 2017

  1. use strict all the things

    isaacs committed Apr 4, 2017
    Copy the full SHA
    75bcb74 View commit details
  2. new Pack class

    isaacs committed Apr 4, 2017
    Copy the full SHA
    42e0b7e View commit details
  3. Copy the full SHA
    31bd5a1 View commit details
  4. Copy the full SHA
    73f8d7c View commit details
  5. Copy the full SHA
    7dd73e4 View commit details
  6. fixes for synchronous packing

    isaacs committed Apr 4, 2017
    Copy the full SHA
    050a245 View commit details
  7. don't force blockLen > size if even multiple of 512

    Confuses bsdtar into thinking the file is over
    isaacs committed Apr 4, 2017
    Copy the full SHA
    0aaf58c View commit details
  8. parallel api sugar for lib/extract.js

    These really need to be rethought, though.  Here's the plan that's
    coming:
    
    For create helper methods, the options object should take a list of
    files to add to the tarball.
    
    If a file is specified, then write out to the file.  Otherwise, return
    the stream, which can be piped as the user sees fit.
    
    If no cb is provided, return a Promise.  Actually, just return a Promise
    no matter what, maybe?
    
    The goal is to mimic the command line.
    
    So, to replicate `tar czf my-tarball.tgz files and folders`, you'd do:
    
        tar.c(
          {
            gzip: <true|gzip options>,
            file: 'my-tarball.tgz',
            glob: <true|glob options>
          },
          ['some', 'files', 'and', 'folders']
        ).then(_ => { .. tarball has been created .. })
    
    To replicate `tar cz files and folders > my-tarball.tgz`, you'd do:
    
        tar.c(
          {
            gzip: <true|gzip options>,
            glob: <true|glob options>
          },
          ['some', 'files', 'and', 'folders']
        ).pipe(fs.createWriteStream('my-tarball.tgz')
    
    To replicate `tar xf my-tarball.tgz` you'd do:
    
        tar.x(
          {
            file: 'my-tarball.tgz'
          }
        ).then(_=> { .. tarball has been dumped in cwd .. })
    
    To replicate `cat my-tarball.tgz | tar x -C some-dir --strip=1`:
    
        fs.createReadStream('my-tarball.tgz').pipe(
          tar.x({
            strip: 1,
            C: 'some-dir' // alias for cwd:'some-dir', also ok
          })
        )
    
    To replicate `tar tf my-tarball.tgz`, do this:
    
        tar.t({ file: 'my-tarball.tgz' })
          .on('entry', entry => { .. do whatever with it .. })
    
    To replicate `cat my-tarball.tgz | tar t` do:
    
        fs.createReadStream('my-tarball.tgz')
          .pipe(tar.t())
          .on('entry', entry => { .. do whatever with it .. })
    
    To do anything synchronous, add `sync: true` to the options.
    isaacs committed Apr 4, 2017
    Copy the full SHA
    da67499 View commit details
  9. Copy the full SHA
    48c70a4 View commit details
  10. Copy the full SHA
    be7c500 View commit details

Commits on Apr 5, 2017

  1. Copy the full SHA
    1e2af14 View commit details
  2. Copy the full SHA
    4c2a772 View commit details
  3. remove dangling comment

    isaacs committed Apr 5, 2017
    Copy the full SHA
    f56414d View commit details
  4. ci: fix travis stuff

    zkat authored Apr 5, 2017
    Copy the full SHA
    cb82241 View commit details
  5. Keep test coverage at 100%

    While only 2 files are covered right now, getting any shortage of test
    coverage reported as a failure is a great practice.
    isaacs committed Apr 5, 2017
    Copy the full SHA
    c53534e View commit details
  6. add a types test

    Not much to test, since it's just 2 map objects, but whatever.
    isaacs committed Apr 5, 2017
    Copy the full SHA
    46d8d13 View commit details
  7. header: support setting the fieldset type

    Also: validate 'type' field, and split the prefix/path properly
    when the prefix size is 0 (because basic fieldset).
    isaacs committed Apr 5, 2017
    Copy the full SHA
    4e1c77d View commit details

Commits on Apr 6, 2017

  1. Copy the full SHA
    b9de083 View commit details
  2. use strict on test files

    isaacs committed Apr 6, 2017
    Copy the full SHA
    2b8ddc1 View commit details
  3. run tests asynchronously

    isaacs committed Apr 6, 2017
    Copy the full SHA
    c4dc561 View commit details
  4. Copy the full SHA
    05d3de2 View commit details

Commits on Apr 7, 2017

  1. Move byte counting into read-entry

    Also, move 'turn a number into a date' into consistent places, so we
    store epoch seconds, rather than a javascript Date.toString() value.
    isaacs committed Apr 7, 2017
    Copy the full SHA
    59373d0 View commit details

Commits on Apr 8, 2017

  1. too much throwing

    isaacs committed Apr 8, 2017
    Copy the full SHA
    1356d4d View commit details
  2. field: add Date type

    types should be as close to the data as possible
    isaacs committed Apr 8, 2017
    Copy the full SHA
    0d248b4 View commit details

Commits on Apr 9, 2017

  1. Copy the full SHA
    1c03d80 View commit details
  2. Copy the full SHA
    0fc6dd1 View commit details
  3. 2
    Copy the full SHA
    ab86f8b View commit details
Showing 432 changed files with 57,002 additions and 2,624 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/fixtures/files/** text eol=lf
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on: [push, pull_request]

jobs:
build:
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
platform:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
- os: windows-latest
shell: powershell

fail-fast: false

runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}

steps:
# there are files here that make windows unhappy by default
- name: Support longpaths
run: git config --global core.longpaths true

- name: Checkout Repository
uses: actions/checkout@v1.1.0

- name: Use Nodejs ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: use latest npm
run: npm i -g npm@latest

- name: Install dependencies
run: npm install

- name: Run Tap Tests
run: npm test -- -c -t0
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.*.swp
node_modules
examples/extract/
test/tmp/
test/fixtures/
.nyc_output/
coverage/
test/fixtures/unpack
benchmarks/extract/cwd
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
language: node_js
sudo: false

node_js:
- 0.10
- 0.11
- node
- 12
- 10
- 8

os:
- linux

cache:
directories:
- $HOME/.npm

notifications:
email: false
3 changes: 3 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
The ISC License

Copyright (c) Isaac Z. Schlueter and Contributors

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
964 changes: 934 additions & 30 deletions README.md

Large diffs are not rendered by default.

224 changes: 224 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
# node-tar benchmarks

There are a bunch of benchmark scripts in `./benchmarks`. These
compare the various ways to use node-tar, tar-fs, tar-stream, and the
fstream version of node-tar.

You can pass a filename to all the parse and extract benchmarks, and a
folder to the create benchmark.

```
$ time tar cf downloads.tar -C ~ Downloads
real 0m23.751s
user 0m0.630s
sys 0m11.743s
$ node benchmarks/create/old-async.js ~/Downloads
42272.452728 (42.3s)
$ node benchmarks/create/tar-fs-async.js ~/Downloads
25599.186971 (25.6s)
$ node benchmarks/create/node-tar-file-sync.js ~/Downloads
23677.560389 (23.7s)
$ node benchmarks/extract/old-async.js downloads.tar
214248.237973 (214.2s)
$ node benchmarks/extract/tar-fs-async.js downloads.tar
33976.501071 (34.0s)
$ node benchmarks/extract/node-tar-file-sync.js downloads.tar
17254.956028 (17.3s)
```

To run a bunch of benchmarks, type `npm run bench`.

```
$ npm run bench
> tar@2.2.1 bench /Users/isaacs/dev/js/tar
> for i in benchmarks/*/*.js; do echo $i; for j in {1..5}; do node $i || break; done; done
benchmarks/create/node-tar-file-async.js
118.153
124.152
117.554
111.221
108.186
benchmarks/create/node-tar-file-sync.js
93.476
93.019
99.313
94.475
89.388
benchmarks/create/node-tar-stream-async.js
109.041
109.456
122.198
108.559
108.101
benchmarks/create/node-tar-stream-sync.js
95.449
100.572
122.602
94.681
95.732
benchmarks/create/old-async.js
285.111
254.173
255.68
270.314
322.798
benchmarks/create/pack-async.js
129.29
134.56
98.538
108.607
120.551
benchmarks/create/pack-sync.js
100.473
98.25
98.448
96.355
93.235
benchmarks/create/tar-fs-async.js
166.825
205.416
168.769
172.992
189.854
benchmarks/extract/node-tar-file-async.js
1228.391 (1.2s)
985.846
1072.73 (1.1s)
859.067
881.437
benchmarks/extract/node-tar-file-sync.js
1215.858 (1.2s)
1086.313 (1.1s)
1132.42 (1.1s)
1076.573 (1.1s)
1188.361 (1.2s)
benchmarks/extract/node-tar-stream-async.js
1035.188
1061.6 (1.1s)
956.506
1103.758 (1.1s)
1186.414 (1.2s)
benchmarks/extract/node-tar-stream-sync.js
1282.724 (1.3s)
1470.698 (1.5s)
1080.566 (1.1s)
1351.072 (1.4s)
1149.005 (1.1s)
benchmarks/extract/old-async.js
2697.997 (2.7s)
2638.7 (2.6s)
2676.483 (2.7s)
2456.808 (2.5s)
2632.987 (2.6s)
benchmarks/extract/old-sync.js
2630.631 (2.6s)
3348.535 (3.3s)
2804.793 (2.8s)
2683.767 (2.7s)
2429.574 (2.4s)
benchmarks/extract/tar-fs-async.js
3476.535 (3.5s)
3295.247 (3.3s)
3649.666 (3.6s)
2990.234 (3s)
3080.088 (3.1s)
benchmarks/extract/tar-fs-sync.js
2912.93 (2.9s)
2906.809 (2.9s)
2895.982 (2.9s)
2788.321 (2.8s)
2763.063 (2.8s)
benchmarks/extract/unpack-async.js
917.924
996.596
980.011
959.166
912.224
benchmarks/extract/unpack-sync.js
1086.979 (1.1s)
1003.369
1007.736
1014.644
965.837
benchmarks/parse/fast-scan-no-body.js
97.161
96.942
92.594
83.1
83.687
benchmarks/parse/fast-scan.js
103.901
99.561
110.304
121.186
108.992
benchmarks/parse/node-tar-file-async.js
142.502
140.748
150.195
139.453
138.621
benchmarks/parse/node-tar-file-sync.js
127.851
125.472
126.201
128.51
125.533
benchmarks/parse/node-tar-stream-async.js
143.174
155.308
148.667
143.529
150.993
benchmarks/parse/node-tar-stream-sync.js
142.549
141.47
135.668
133.812
126.849
benchmarks/parse/old-async.js
170.105
146.608
148.354
155.255
175.018
benchmarks/parse/old-sync.js
126.975
125.584
126.011
128.157
126.623
benchmarks/parse/parse-async.js
164.151
145.304
160.246
148.458
224.993
benchmarks/parse/parse-sync.js
125.92
142.842
115.224
116.128
119.958
benchmarks/parse/tar-stream-async.js
157.796
143.333
143.042
149.831
147.184
benchmarks/parse/tar-stream-sync.js
126.07
120.343
125.797
116.791
126.587
```
12 changes: 12 additions & 0 deletions benchmarks/create/node-tar-file-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const tar = require('../..')
const timer = require('../timer.js')()
tar.c({
file: file,
cwd: cwd
}, ['']).then(timer)
14 changes: 14 additions & 0 deletions benchmarks/create/node-tar-file-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const tar = require('../..')
const timer = require('../timer.js')()
tar.c({
file: file,
sync: true,
cwd: cwd
}, [''])
timer()
10 changes: 10 additions & 0 deletions benchmarks/create/node-tar-stream-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const tar = require('../..')
const timer = require('../timer.js')()
const c = tar.c({ cwd: cwd }, [''])
c.pipe(fs.createWriteStream(file)).on('close', timer)
11 changes: 11 additions & 0 deletions benchmarks/create/node-tar-stream-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const tar = require('../..')
const timer = require('../timer.js')()
const c = tar.c({ cwd: cwd, sync: true }, [''])
fs.writeFileSync(file, c.read())
timer()
14 changes: 14 additions & 0 deletions benchmarks/create/old-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const Reader = require('fstream').Reader
const Pack = require('tar').Pack
const timer = require('../timer.js')()
const d = new Reader({ path: cwd })
const p = new Pack()
const fstr = fs.createWriteStream(file)
d.pipe(p).pipe(fstr)
fstr.on('close', timer)
11 changes: 11 additions & 0 deletions benchmarks/create/pack-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const Pack = require('../../lib/pack.js')
const timer = require('../timer.js')()
const p = new Pack({ cwd: cwd })
p.add('').end()
p.pipe(fs.createWriteStream(file)).on('finish', timer)
12 changes: 12 additions & 0 deletions benchmarks/create/pack-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const Pack = require('../../lib/pack.js')
const timer = require('../timer.js')()
const p = new Pack.Sync({ cwd: cwd })
p.add('')
fs.writeFileSync(file, p.read())
timer()
10 changes: 10 additions & 0 deletions benchmarks/create/tar-fs-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const path = require('path')
const cwd = process.argv[2] || path.dirname(__dirname)
const file = '/tmp/benchmark.tar'
const fs = require('fs')
process.on('exit', _ => fs.unlinkSync(file))

const tar = require('tar-fs')
const timer = require('../timer.js')()
const p = tar.pack(cwd)
p.pipe(fs.createWriteStream(file)).on('close', timer)
14 changes: 14 additions & 0 deletions benchmarks/extract/node-tar-file-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const tar = require('../..')
const timer = require('../timer.js')()
tar.x({
file: file,
cwd: cwd
}).then(timer)
16 changes: 16 additions & 0 deletions benchmarks/extract/node-tar-file-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const tar = require('../..')
const timer = require('../timer.js')()
tar.x({
file: file,
sync: true,
cwd: cwd
})
timer()
14 changes: 14 additions & 0 deletions benchmarks/extract/node-tar-stream-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const fs = require('fs')
const tar = require('../..')
const timer = require('../timer.js')()
const x = tar.x({ cwd: cwd })
x.on('end', timer)
fs.createReadStream(file).pipe(x)
14 changes: 14 additions & 0 deletions benchmarks/extract/node-tar-stream-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const fs = require('fs')
const tar = require('../..')
const timer = require('../timer.js')()
const x = tar.x({ sync: true, cwd: cwd })
x.on('end', timer)
x.end(fs.readFileSync(file))
15 changes: 15 additions & 0 deletions benchmarks/extract/old-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const fs = require('fs')
const Extract = require('tar').Extract
const timer = require('../timer.js')()
const x = new Extract({ path: cwd })
x.on('entry', entry => entry.resume())
x.on('close', timer)
fs.createReadStream(file).pipe(x)
16 changes: 16 additions & 0 deletions benchmarks/extract/old-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const fs = require('fs')
const Extract = require('tar').Extract
const data = fs.readFileSync(file)
const timer = require('../timer.js')()
const x = new Extract({ path: cwd })
x.on('entry', entry => entry.resume())
x.on('close', timer)
x.end(data)
14 changes: 14 additions & 0 deletions benchmarks/extract/tar-fs-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const tar = require('tar-fs')
const fs = require('fs')
const timer = require('../timer.js')()
const e = tar.extract(cwd)
process.on('exit', timer)
fs.createReadStream(file).pipe(e)
16 changes: 16 additions & 0 deletions benchmarks/extract/tar-fs-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const fs = require('fs')
const tar = require('tar-fs')
const data = fs.readFileSync(file)

const timer = require('../timer.js')()
const e = tar.extract(cwd)
process.on('exit', timer)
e.end(data)
15 changes: 15 additions & 0 deletions benchmarks/extract/unpack-async.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const Unpack = require('../../lib/unpack.js')
const fs = require('fs')

const timer = require('../timer.js')()
const u = new Unpack({ cwd: cwd })
u.on('close', timer)
fs.createReadStream(file).pipe(u)
16 changes: 16 additions & 0 deletions benchmarks/extract/unpack-sync.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const cwd = __dirname + '/cwd'
const rimraf = require('rimraf')
rimraf.sync(cwd)
require('mkdirp').sync(cwd)
process.on('exit', _ => rimraf.sync(cwd))
const path = require('path')
const file = process.argv[2] || path.resolve(__dirname, '../npm.tar')

const fs = require('fs')
const Unpack = require('../../lib/unpack.js')
const data = fs.readFileSync(file)

const timer = require('../timer.js')()
const u = new Unpack.Sync({ cwd: cwd })
u.end(data)
timer()
1 change: 1 addition & 0 deletions benchmarks/node_modules/.bin/mkdirp
1 change: 1 addition & 0 deletions benchmarks/node_modules/.bin/rimraf
5 changes: 5 additions & 0 deletions benchmarks/node_modules/balanced-match/.npmignore
21 changes: 21 additions & 0 deletions benchmarks/node_modules/balanced-match/LICENSE.md
91 changes: 91 additions & 0 deletions benchmarks/node_modules/balanced-match/README.md
59 changes: 59 additions & 0 deletions benchmarks/node_modules/balanced-match/index.js
77 changes: 77 additions & 0 deletions benchmarks/node_modules/balanced-match/package.json
25 changes: 25 additions & 0 deletions benchmarks/node_modules/block-stream/LICENCE
15 changes: 15 additions & 0 deletions benchmarks/node_modules/block-stream/LICENSE
14 changes: 14 additions & 0 deletions benchmarks/node_modules/block-stream/README.md
209 changes: 209 additions & 0 deletions benchmarks/node_modules/block-stream/block-stream.js
63 changes: 63 additions & 0 deletions benchmarks/node_modules/block-stream/package.json
129 changes: 129 additions & 0 deletions benchmarks/node_modules/brace-expansion/README.md
201 changes: 201 additions & 0 deletions benchmarks/node_modules/brace-expansion/index.js
75 changes: 75 additions & 0 deletions benchmarks/node_modules/brace-expansion/package.json
4 changes: 4 additions & 0 deletions benchmarks/node_modules/concat-map/.travis.yml
18 changes: 18 additions & 0 deletions benchmarks/node_modules/concat-map/LICENSE
62 changes: 62 additions & 0 deletions benchmarks/node_modules/concat-map/README.markdown
6 changes: 6 additions & 0 deletions benchmarks/node_modules/concat-map/example/map.js
13 changes: 13 additions & 0 deletions benchmarks/node_modules/concat-map/index.js
92 changes: 92 additions & 0 deletions benchmarks/node_modules/concat-map/package.json
39 changes: 39 additions & 0 deletions benchmarks/node_modules/concat-map/test/map.js
43 changes: 43 additions & 0 deletions benchmarks/node_modules/fs.realpath/LICENSE
33 changes: 33 additions & 0 deletions benchmarks/node_modules/fs.realpath/README.md
66 changes: 66 additions & 0 deletions benchmarks/node_modules/fs.realpath/index.js
303 changes: 303 additions & 0 deletions benchmarks/node_modules/fs.realpath/old.js
62 changes: 62 additions & 0 deletions benchmarks/node_modules/fs.realpath/package.json
9 changes: 9 additions & 0 deletions benchmarks/node_modules/fstream/.travis.yml
15 changes: 15 additions & 0 deletions benchmarks/node_modules/fstream/LICENSE
76 changes: 76 additions & 0 deletions benchmarks/node_modules/fstream/README.md
134 changes: 134 additions & 0 deletions benchmarks/node_modules/fstream/examples/filter-pipe.js
118 changes: 118 additions & 0 deletions benchmarks/node_modules/fstream/examples/pipe.js
68 changes: 68 additions & 0 deletions benchmarks/node_modules/fstream/examples/reader.js
27 changes: 27 additions & 0 deletions benchmarks/node_modules/fstream/examples/symlink-write.js
35 changes: 35 additions & 0 deletions benchmarks/node_modules/fstream/fstream.js
85 changes: 85 additions & 0 deletions benchmarks/node_modules/fstream/lib/abstract.js
70 changes: 70 additions & 0 deletions benchmarks/node_modules/fstream/lib/collect.js
Loading