temp-write
Advanced tools
Comparing version 3.0.0 to 3.1.0
13
index.js
@@ -11,4 +11,15 @@ 'use strict'; | ||
const TMP_DIR = os.tmpdir(); | ||
const tempfile = filepath => path.join(TMP_DIR, uuid.v4(), (filepath || '')); | ||
// Workaround for https://github.com/nodejs/node/issues/11422 | ||
let _resolved; | ||
const getTmpDir = () => { | ||
if (!_resolved) { | ||
_resolved = fs.realpathSync(TMP_DIR); | ||
} | ||
return _resolved; | ||
}; | ||
const tempfile = filepath => path.join(getTmpDir(), uuid.v4(), (filepath || '')); | ||
const writeStream = (filepath, input) => new Promise((resolve, reject) => { | ||
@@ -15,0 +26,0 @@ const writable = fs.createWriteStream(filepath); |
{ | ||
"name": "temp-write", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Write string/buffer/stream to a random temp file", | ||
@@ -45,4 +45,5 @@ "license": "MIT", | ||
"ava": "*", | ||
"proxyquire": "^1.7.11", | ||
"xo": "*" | ||
} | ||
} |
4863
46
3