diff --git a/lib/methods.js b/lib/methods.js index e0d3363..7e03f3b 100644 --- a/lib/methods.js +++ b/lib/methods.js @@ -94,7 +94,32 @@ module.exports = function (FQ) { this.execQueue(); }; + + /** + * Asynchronously append data to file + * https://nodejs.org/docs/v0.10.15/api/fs.html#fs_fs_appendfile_filename_data_options_callback + */ + FQ.prototype.appendFile = function(filename, data, options, callback) { + + if(!callback) { + callback = options; + options = null; + } + + this.addToQueue(function(fs, cb) { + if(options) { + fs.appendFile(filename, data, options, cb); + return; + } + + fs.appendFile(filename, data, cb); + + }, callback); + + this.execQueue(); + }; + /** * Asynchronous stat * http://nodejs.org/docs/v0.10.15/api/fs.html#fs_fs_stat_path_callback @@ -213,4 +238,4 @@ module.exports = function (FQ) { return writeStream; }; -}; \ No newline at end of file +};