Comparing version 0.0.28 to 0.0.29
@@ -15,6 +15,3 @@ /*! | ||
path = require('path'), | ||
os = require('os'), | ||
crypto = require('crypto'), | ||
exists = fs.exists || path.exists, | ||
existsSync = fs.existsSync || path.existsSync, | ||
tmpDir = require('os-tmpdir'), | ||
@@ -161,4 +158,4 @@ _c = require('constants'); | ||
// check whether the path exists then retry if needed | ||
exists(name, function _pathExists(pathExists) { | ||
if (pathExists) { | ||
fs.stat(name, function (err) { | ||
if (!err) { | ||
if (tries-- > 0) return _getUniqueName(); | ||
@@ -195,4 +192,6 @@ | ||
var name = _generateTmpName(opts); | ||
if (!existsSync(name)) { | ||
return name; | ||
try { | ||
fs.statSync(name); | ||
} catch (e) { | ||
return name; | ||
} | ||
@@ -358,3 +357,3 @@ } while (tries-- > 0); | ||
// 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 && e.errno != -_c.ENOENT) { | ||
// reraise any unanticipated error | ||
@@ -407,3 +406,3 @@ throw e; | ||
var index = _removeObjects.indexOf(removeFunction); | ||
var index = _removeObjects.indexOf(_cleanupCallback); | ||
if (index >= 0) { | ||
@@ -410,0 +409,0 @@ _removeObjects.splice(index, 1); |
{ | ||
"name": "tmp", | ||
"version": "0.0.28", | ||
"version": "0.0.29", | ||
"description": "Temporary file and directory creator", | ||
@@ -5,0 +5,0 @@ "author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)", |
@@ -5,3 +5,4 @@ # Tmp | ||
[![Build Status](https://secure.travis-ci.org/raszi/node-tmp.png?branch=master)](http://travis-ci.org/raszi/node-tmp) | ||
[![Build Status](https://travis-ci.org/raszi/node-tmp.svg?branch=master)](https://travis-ci.org/raszi/node-tmp) | ||
[![Dependencies](https://david-dm.org/raszi/node-tmp.svg)](https://david-dm.org/raszi/node-tmp) | ||
@@ -191,3 +192,3 @@ ## About | ||
### mkstemps like, asynchronously | ||
### mkstemp like, asynchronously | ||
@@ -206,3 +207,3 @@ Creates a new temporary directory with mode `0700` and filename like `/tmp/tmp-nk2J1u`. | ||
### mkstemps like, synchronously | ||
### mkstemp like, synchronously | ||
@@ -260,3 +261,3 @@ This will behave similarly to the asynchronous version. | ||
* `postfix`: the optional postfix, fallbacks to `.tmp` on file creation | ||
* `template`: [`mkstemps`][3] like filename template, no default | ||
* `template`: [`mkstemp`][3] like filename template, no default | ||
* `dir`: the optional temporary directory, fallbacks to system default (guesses from environment) | ||
@@ -263,0 +264,0 @@ * `tries`: how many times should the function try to get a unique filename before giving up, default `3` |
Sorry, the diff of this file is not supported yet
66842
39
268
1473