tmp-promise
Advanced tools
Comparing version 2.0.1 to 2.0.2
14
index.js
@@ -6,6 +6,5 @@ const {promisify} = require("util"); | ||
module.exports.fileSync = tmp.fileSync; | ||
const fileWithOptions = promisify( | ||
(options, cb) => tmp.file( | ||
options, | ||
(err, path, fd, cleanup) => cb(err, {path, fd, cleanup: promisify(cleanup)}) | ||
const fileWithOptions = promisify((options, cb) => | ||
tmp.file(options, (err, path, fd, cleanup) => | ||
err ? cb(err) : cb(undefined, { path, fd, cleanup: promisify(cleanup) }) | ||
) | ||
@@ -27,6 +26,5 @@ ); | ||
module.exports.dirSync = tmp.dirSync; | ||
const dirWithOptions = promisify( | ||
(options, cb) => tmp.dir( | ||
options, | ||
(err, path, cleanup) => cb(err, {path, cleanup: promisify(cleanup)}) | ||
const dirWithOptions = promisify((options, cb) => | ||
tmp.dir(options, (err, path, cleanup) => | ||
err ? cb(err) : cb(undefined, { path, cleanup: promisify(cleanup) }) | ||
) | ||
@@ -33,0 +31,0 @@ ); |
{ | ||
"name": "tmp-promise", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "The tmp package with promises support and disposers.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# tmp-promise | ||
[![CircleCI](https://circleci.com/gh/benjamingr/tmp-promise.svg?style=svg)](https://circleci.com/gh/benjamingr/tmp-promise) | ||
[![npm version](https://badge.fury.io/js/tmp-promise.svg)](https://badge.fury.io/js/tmp-promise) | ||
A simple utility for creating temporary files or directories. | ||
@@ -4,0 +7,0 @@ |
18
test.js
@@ -51,2 +51,11 @@ const fs = require('fs') | ||
}) | ||
it('propagates errors', async function() { | ||
try { | ||
await tmp.file({ dir: 'nonexistent-path' }); | ||
throw Error('Expected to throw'); | ||
} catch (e) { | ||
assert.ok(e.message.startsWith('ENOENT: no such file or directory')); | ||
} | ||
}); | ||
}) | ||
@@ -88,2 +97,11 @@ | ||
}) | ||
it('propagates errors', async function() { | ||
try { | ||
await tmp.dir({ dir: 'nonexistent-path' }); | ||
throw Error('Expected to throw'); | ||
} catch (e) { | ||
assert.ok(e.message.startsWith('ENOENT: no such file or directory')); | ||
} | ||
}); | ||
}) | ||
@@ -90,0 +108,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17406
8
223
317
0