Skip to content

Instantly share code, notes, and snippets.

@heapwolf heapwolf/53.js
Created Aug 7, 2012

Embed
What would you like to do?
fs/write
var fs = require('fs');
fs.open('./my_file_2.txt', 'a', function opened(err, fd) {
if (err) { throw err; }
var writeBuffer = new Buffer('writing this string'),
bufferPosition = 0,
bufferLength = writeBuffer.length, filePosition = null;
fs.write(fd, writeBuffer, bufferPosition, bufferLength, filePosition,
function wrote(err, written) {
if (err) { throw err; }
console.log('wrote ' + written + ' bytes');
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.