From f24fd91144d935135738f263f310bed4f57b3c96 Mon Sep 17 00:00:00 2001 From: Sharath Chander Reddy Baddam Date: Mon, 3 Oct 2016 13:20:57 -0400 Subject: [PATCH] added fs.open method --- lib/methods.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/methods.js b/lib/methods.js index e0d3363..5e41931 100644 --- a/lib/methods.js +++ b/lib/methods.js @@ -165,6 +165,27 @@ module.exports = function (FQ) { this.execQueue(); }; + FQ.prototype.open = function(path, flags, mode, callback) { + + if(!callback) { + callback = mode; + mode = null; + } + + this.addToQueue(function(fs, cb) { + + if(mode) { + fs.open(path, flags, mode, cb); + return; + } + + fs.open(path, flags, cb); + + }, callback); + + this.execQueue(); + }; + /** * http://nodejs.org/docs/v0.10.15/api/fs.html#fs_class_fs_readstream */