Sha256: 7399565850b68f9ca79baba619149a30a75150b7c2e5a82eb5b7f5eba8a03f7f
Contents?: true
Size: 692 Bytes
Versions: 17
Compression:
Stored size: 692 Bytes
Contents
var path = require('path'); var fs = require('fs'); var os = require('os'); var rimraf = require('rimraf'); var log = require('./logger').create('temp-dir'); // Node v0.8 uses tmpDir(), v0.10 uses tmpdir(). var TEMP_DIR = os.tmpdir ? os.tmpdir() : os.tmpDir(); module.exports = { getPath: function(suffix) { return path.normalize(TEMP_DIR + suffix); }, create: function(path) { log.debug('Creating temp dir at %s', path); try { fs.mkdirSync(path); } catch (e) { log.warn('Failed to create a temp dir at %s', path); } return path; }, remove: function(path, done) { log.debug('Cleaning temp dir %s', path); rimraf(path, done); } };
Version data entries
17 entries across 17 versions & 2 rubygems