diff options
Diffstat (limited to 'lib/fs/index.js')
-rw-r--r-- | lib/fs/index.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/fs/index.js b/lib/fs/index.js index bcd9345..4fd63e9 100644 --- a/lib/fs/index.js +++ b/lib/fs/index.js @@ -2,6 +2,7 @@ var _ = require('lodash'); var path = require('path'); var Buffer = require('buffer').Buffer; var destroy = require('destroy'); +var os = require('os'); var Promise = require('../utils/promise'); @@ -45,10 +46,14 @@ FS.prototype.readdir = function(folder) { // To implement for each fs }; - // These methods don't require to be redefined, by default it uses .exists, .read, .write, .list // For optmization, it can be redefined: +// Allocate a new temporary directory +FS.prototype.tmpdir = function() { + return path.resolve(os.tmpdir(), _.uniqueId('gitbook_tmp_')); +}; + // List files in a directory FS.prototype.listFiles = function(folder) { return this.readdir(folder) |