temp-write
Advanced tools
Comparing version 3.1.0 to 3.2.0
16
index.js
'use strict'; | ||
const os = require('os'); | ||
const path = require('path'); | ||
@@ -9,17 +8,6 @@ const fs = require('graceful-fs'); | ||
const pify = require('pify'); | ||
const tempDir = require('temp-dir'); | ||
const TMP_DIR = os.tmpdir(); | ||
const tempfile = filepath => path.join(tempDir, 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) => { | ||
@@ -26,0 +14,0 @@ const writable = fs.createWriteStream(filepath); |
{ | ||
"name": "temp-write", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Write string/buffer/stream to a random temp file", | ||
@@ -34,3 +34,4 @@ "license": "MIT", | ||
"string", | ||
"buffer" | ||
"buffer", | ||
"stream" | ||
], | ||
@@ -42,2 +43,3 @@ "dependencies": { | ||
"pify": "^2.2.0", | ||
"temp-dir": "^1.0.0", | ||
"uuid": "^3.0.1" | ||
@@ -47,5 +49,4 @@ }, | ||
"ava": "*", | ||
"proxyquire": "^1.7.11", | ||
"xo": "*" | ||
} | ||
} |
@@ -60,3 +60,3 @@ # temp-write [![Build Status](https://travis-ci.org/sindresorhus/temp-write.svg?branch=master)](https://travis-ci.org/sindresorhus/temp-write) | ||
- [tempfile](https://github.com/sindresorhus/tempfile) - Get a random temp file path | ||
- [tempy](https://github.com/sindresorhus/tempy) - Get a random temporary file or directory path | ||
@@ -63,0 +63,0 @@ |
2
4674
6
37
+ Addedtemp-dir@^1.0.0
+ Addedtemp-dir@1.0.0(transitive)