Skip to content

Commit

Permalink
perf(tar): read files with stream
Browse files Browse the repository at this point in the history
If no provide stats to `archiver` then stream will be loaded as buffer
(analogue `fs.readFile`).

This slowed the work with large files.

Before this change:

```
real   	1m23.794s
user   	1m26.043s
sys    	0m17.291s
```

After this change:

```
real   	1m7.710s
user   	1m8.288s
sys    	0m6.331s
```
  • Loading branch information
blond committed Sep 7, 2016
1 parent a0bdd18 commit 8fbc2f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/streams/tar-stream.js
Expand Up @@ -86,7 +86,9 @@ module.exports = class TarStream extends stream.Writable {

this._archive.append(content, {
name: relative,
type: type
type: type,
_stats: stats,
size: stats.size
});

callback();
Expand Down

0 comments on commit 8fbc2f3

Please sign in to comment.