Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ unreleased
- deps: [email protected]
- deps: statuses@'>= 1.3.1 < 2'
* deps: statuses@~1.5.0
* perf: remove redundant `path.normalize` call

0.16.2 / 2018-02-07
===================
Expand Down
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ SendStream.prototype.pipe = function pipe (res) {

// join / normalize from optional root dir
path = normalize(join(root, path))
root = normalize(root + sep)
} else {
// ".." is malicious without "root"
if (UP_PATH_REGEXP.test(path)) {
Expand Down Expand Up @@ -795,6 +794,15 @@ SendStream.prototype.stream = function stream (path, options) {

// pipe
var stream = fs.createReadStream(path, options)

// apply additional transformation streams if any
if (options.transformStreams) {
for(var i = 0; i < options.transformStreams.length; i++) {
var transform = options.transformStreams[i];
stream = stream.pipe(transform);
}
}

this.emit('stream', stream)
stream.pipe(res)

Expand Down