mirror of
https://github.com/Raghu-Ch/nodeRestAPI.git
synced 2026-02-11 13:13:02 -05:00
initial commit
This commit is contained in:
22
node_modules/vinyl-fs/lib/dest/writeContents/writeStream.js
generated
vendored
Normal file
22
node_modules/vinyl-fs/lib/dest/writeContents/writeStream.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'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;
|
||||
Reference in New Issue
Block a user