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.
31 lines
658 B
31 lines
658 B
'use strict'; |
|
|
|
var fo = require('../../file-operations'); |
|
|
|
function writeBuffer(file, optResolver, onWritten) { |
|
var flags = fo.getFlags({ |
|
overwrite: optResolver.resolve('overwrite', file), |
|
append: optResolver.resolve('append', file), |
|
}); |
|
var opt = { |
|
mode: file.stat.mode, |
|
flags: flags, |
|
}; |
|
|
|
fo.writeFile(file.path, file.contents, opt, onWriteFile); |
|
|
|
function onWriteFile(writeErr, fd) { |
|
if (writeErr) { |
|
return fo.closeFd(writeErr, fd, onWritten); |
|
} |
|
|
|
fo.updateMetadata(fd, file, onUpdate); |
|
|
|
function onUpdate(updateErr) { |
|
fo.closeFd(updateErr, fd, onWritten); |
|
} |
|
} |
|
|
|
} |
|
|
|
module.exports = writeBuffer;
|
|
|