mirror of
https://github.com/tiennm99/FBcount.git
synced 2026-10-03 09:58:33 +00:00
Init
This commit is contained in:
1 parent
d10a3b793b
commit
e81094b0d2
4280 files changed
+484929
No files matched your search
+25
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
var osTmpdir = require('os-tmpdir');
|
||||
var uid2 = require('uid2');
|
||||
var mkdirp = require('mkdirp');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function (options) {
|
||||
options = options || {};
|
||||
var uniqueDir = path.join(osTmpdir(), uid2(options.length || 20));
|
||||
if (options.create) {
|
||||
mkdirp.sync(uniqueDir);
|
||||
}
|
||||
if (options.thunk) {
|
||||
return thunk(uniqueDir);
|
||||
}
|
||||
return uniqueDir;
|
||||
};
|
||||
|
||||
function thunk(uniquedir) {
|
||||
return function () {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(uniquedir);
|
||||
return path.join.apply(path, args);
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user