Skip to content

Commit

Permalink
fix(asset): stop using vinyl.pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
kt3k committed Oct 16, 2016
1 parent 5da3b0c commit 9a923ff
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/Asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,18 @@ class Asset extends EventEmitter {
return new Promise((resolve, reject) => {
var contents = new Buffer([])

vinyl.pipe(through2((data, enc, callback) => {
contents = Buffer.concat([contents, new Buffer(data)])
callback(null)
}, () => {
resolve(contents)
})).on('error', err => { reject(err) })
if (vinyl.isStream()) {
vinyl.pipe(through2((data, enc, callback) => {
contents = Buffer.concat([contents, new Buffer(data)])
callback(null)
}, () => {
resolve(contents)
})).on('error', err => { reject(err) })
} else if (vinyl.isBuffer()) {
resolve(vinyl.contents)
} else {
reject(new Error('unsupported vinyl type:' + vinyl.path))
}
})
}

Expand Down

0 comments on commit 9a923ff

Please sign in to comment.