Asynchronously appends data to a file.
file path or file descriptor
data to append
options (if a string, the value is the encoding)
callback to invoke after appending data to a file
function onAppend( err ) {
if ( err ) {
console.log( err.message );
}
}
var opts = { 'flag': 'r' };
appendFile( './beep/boop.txt', 'beep boop\n', opts, onAppend );
Asynchronously appends data to a file.
file path or file descriptor
data to append
callback to invoke after appending data to a file
function onAppend( err ) {
if ( err ) {
console.log( err.message );
}
}
appendFile( './beep/boop.txt', 'beep boop\n', onAppend );
Synchronously appends data to a file.
file path or file descriptor
data to append
options (if a string, the value is the encoding)
error object or null
var err = appendFileSync( './beep/boop.txt', 'data to append\n' );
if ( err instanceof Error ) {
throw err;
}
Interface for appending a file.