diff --git a/lib/tmp.js b/lib/tmp.js index 5859d74..e2c8fe7 100644 --- a/lib/tmp.js +++ b/lib/tmp.js @@ -170,6 +170,7 @@ function tmpName(options, callback) { return cb(new Error('Invalid template provided')); (function _getUniqueName() { + const name = _generateTmpName(opts); // check whether the path exists then retry if needed @@ -285,7 +286,7 @@ function fileSync(options) { args = _parseArguments(options), opts = args[0]; - opts.postfix = opts.postfix || '.tmp'; + opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix; const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor; const name = tmpNameSync(opts);