You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
463 B
22 lines
463 B
'use strict'; |
|
|
|
var streamFile = require('../../src/getContents/streamFile'); |
|
var fs = require('graceful-fs'); |
|
|
|
function writeStream (writePath, file, cb) { |
|
var opt = { |
|
mode: file.stat.mode |
|
}; |
|
|
|
var outStream = fs.createWriteStream(writePath, opt); |
|
|
|
file.contents.once('error', cb); |
|
outStream.once('error', cb); |
|
outStream.once('finish', function() { |
|
streamFile(file, cb); |
|
}); |
|
|
|
file.contents.pipe(outStream); |
|
} |
|
|
|
module.exports = writeStream;
|
|
|