Comparing version 0.0.29 to 0.0.30
@@ -17,3 +17,3 @@ /*! | ||
tmpDir = require('os-tmpdir'), | ||
_c = require('constants'); | ||
_c = process.binding('constants'); | ||
@@ -35,3 +35,3 @@ | ||
CREATE_FLAGS = _c.O_CREAT | _c.O_EXCL | _c.O_RDWR, | ||
CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR), | ||
@@ -97,4 +97,4 @@ DIR_MODE = 448 /* 0700 */, | ||
var | ||
tmp = options; | ||
options = callback || {}; | ||
tmp = options, | ||
options = callback || {}, | ||
callback = tmp; | ||
@@ -194,5 +194,5 @@ } else if (typeof options == 'undefined') { | ||
try { | ||
fs.statSync(name); | ||
fs.statSync(name); | ||
} catch (e) { | ||
return name; | ||
return name; | ||
} | ||
@@ -217,3 +217,3 @@ } while (tries-- > 0); | ||
opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix; | ||
opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix; | ||
@@ -245,3 +245,3 @@ // gets a temporary filename | ||
opts.postfix = opts.postfix || '.tmp'; | ||
opts.postfix = opts.postfix || '.tmp'; | ||
@@ -282,3 +282,3 @@ var name = _getTmpNameSync(opts); | ||
dirs.push(dir); | ||
} | ||
} | ||
dirs.push(file); | ||
@@ -358,6 +358,6 @@ } else { | ||
catch (e) { | ||
// under some node/windows related circumstances, a temporary file | ||
// under some node/windows related circumstances, a temporary file | ||
// may have not be created as expected or the file was already closed | ||
// by the user, in which case we will simply ignore the error | ||
if (e.errno != -_c.EBADF && e.errno != -_c.ENOENT) { | ||
if (e.errno != -(_c.EBADF || _c.os.errno.EBADF) && e.errno != -(_c.ENOENT || _c.os.errno.ENOENT)) { | ||
// reraise any unanticipated error | ||
@@ -430,5 +430,7 @@ throw e; | ||
for (var i = 0, length = _removeObjects.length; i < length; i++) { | ||
// the function being called removes itself from _removeObjects, | ||
// loop until _removeObjects is empty | ||
while (_removeObjects.length) { | ||
try { | ||
_removeObjects[i].call(null); | ||
_removeObjects[0].call(null); | ||
} catch (e) { | ||
@@ -435,0 +437,0 @@ // already removed? |
{ | ||
"name": "tmp", | ||
"version": "0.0.29", | ||
"version": "0.0.30", | ||
"description": "Temporary file and directory creator", | ||
@@ -5,0 +5,0 @@ "author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)", |
@@ -7,2 +7,3 @@ # Tmp | ||
[![Dependencies](https://david-dm.org/raszi/node-tmp.svg)](https://david-dm.org/raszi/node-tmp) | ||
[![npm version](https://badge.fury.io/js/tmp.svg)](https://badge.fury.io/js/tmp) | ||
@@ -9,0 +10,0 @@ ## About |
Sorry, the diff of this file is not supported yet
162050
1917
269
37