Created
August 7, 2012 22:31
-
-
Save heapwolf/3290078 to your computer and use it in GitHub Desktop.
fs/write
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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