summaryrefslogtreecommitdiffstats
path: root/lib/fs
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-11 17:30:58 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-11 17:30:58 +0100
commit98a13cf487e3b2823cfde38ab1d1b8f97f614517 (patch)
tree81d07c7095822867ba180a79e9a5b1343d81de0e /lib/fs
parent7f9aa214a412f3d173ac52042bd7250aacda6143 (diff)
downloadgitbook-98a13cf487e3b2823cfde38ab1d1b8f97f614517.zip
gitbook-98a13cf487e3b2823cfde38ab1d1b8f97f614517.tar.gz
gitbook-98a13cf487e3b2823cfde38ab1d1b8f97f614517.tar.bz2
Add conrefs loader for nunjucks
Diffstat (limited to 'lib/fs')
-rw-r--r--lib/fs/index.js7
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)