Socket
Socket
Sign inDemoInstall

tmp-promise

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tmp-promise - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

4

package.json
{
"name": "tmp-promise",
"version": "1.0.5",
"version": "1.1.0",
"description": "The tmp package with promises support and disposers.",

@@ -25,3 +25,3 @@ "main": "index.js",

"bluebird": "^3.5.0",
"tmp": "0.0.33"
"tmp": "0.1.0"
},

@@ -28,0 +28,0 @@ "devDependencies": {

@@ -5,3 +5,3 @@ # tmp-promise

The [tmp](https://github.com/raszi/node-tmp) package with promises support.
The [tmp](https://github.com/raszi/node-tmp) package with promises support. If you want to use `tmp` with `async/await` then this helper might be for you.

@@ -33,2 +33,16 @@ This documentation is mostly copied from that package's - but with promise usage instead of callback usage adapted.

With Node.js 10 and es - modules:
```js
import { file } from 'tmp-promise'
(async () => {
const {fd, path, cleanup} = await file();
// work with file here in fd
cleanup();
})();
```
Or the older way:
```javascript

@@ -50,3 +64,16 @@ var tmp = require('tmp-promise');

With Node.js 10 and es - modules:
```js
import { withFile } from 'tmp-promise'
withFile(async ({path, fd}) => {
// when this function returns or throws - release the file
await doSomethingWithFile(db);
});
```
Or the older way:
```js
tmp.withFile(o => {

@@ -53,0 +80,0 @@ console.log("File: ", o.path);

var accessSync = require('fs').accessSync
var assert = require('assert')
var extname = require('path').extname
var existsSync = require('fs').existsSync

@@ -20,3 +21,3 @@ var tmp = require('.')

assert.strictEqual(extname(filepath), '.txt')
}, {postfix: '.txt'})
}, {discardDescriptor: true, postfix: '.txt'})
.then(function()

@@ -23,0 +24,0 @@ {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc