system_assignation/node_modules/tmp-promise/example-usage.js

9 lines
288 B
JavaScript
Raw Normal View History

2022-03-24 09:22:39 -04:00
var tmp = require("./index.js");
var Promise = require("bluebird"); // just for delay, this works with native promises
// disposer
tmp.withFile((path) => {
console.log("Created at path", path);
return Promise.delay(1000);
}).then(() => {
console.log("File automatically disposed");
});