Socket
Socket
Sign inDemoInstall

temp-file

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

temp-file - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

57

out/main.js

@@ -48,3 +48,3 @@ "use strict";

let promise;
const systemTmpDir = process.env.TEST_TMP_DIR || process.env.ELECTRON_BUILDER_TEST_DIR || (0, (_os || _load_os()).tmpdir)();
const systemTmpDir = process.env.TEST_TMP_DIR || process.env.ELECTRON_BUILDER_TMP_DIR || process.env.ELECTRON_BUILDER_TEST_DIR || (0, (_os || _load_os()).tmpdir)();
if ((_fsExtraP || _load_fsExtraP()).mkdtemp == null) {

@@ -57,28 +57,33 @@ const dir = _path.join(systemTmpDir, getTempName("temp-files"));

return promise.then(it => (0, (_fsExtraP || _load_fsExtraP()).realpath)(it)).then(dir => {
require("async-exit-hook")(callback => {
const managers = Array.from(tmpDirManagers);
tmpDirManagers.clear();
if (callback == null) {
for (const manger of managers) {
manger.cleanupSync();
}
try {
(0, (_fsExtraP || _load_fsExtraP()).removeSync)(dir);
} catch (e) {
handleError(e, dir);
}
return;
if (process.env.TMP_DIR_MANAGER_ENSURE_REMOVED_ON_EXIT !== "false") {
addExitHook(dir);
}
return dir;
});
});
function addExitHook(dir) {
require("async-exit-hook")(callback => {
const managers = Array.from(tmpDirManagers);
tmpDirManagers.clear();
if (callback == null) {
for (const manager of managers) {
manager.cleanupSync();
}
// each instead of map to avoid fs overload
(_bluebirdLst || _load_bluebirdLst()).default.each(managers, it => it.cleanup()).then(() => (0, (_fsExtraP || _load_fsExtraP()).remove)(dir)).then(() => callback()).catch(e => {
try {
handleError(e, dir);
} finally {
callback();
}
});
try {
(0, (_fsExtraP || _load_fsExtraP()).removeSync)(dir);
} catch (e) {
handleError(e, dir);
}
return;
}
// each instead of map to avoid fs overload
(_bluebirdLst || _load_bluebirdLst()).default.each(managers, it => it.cleanup()).then(() => (0, (_fsExtraP || _load_fsExtraP()).remove)(dir)).then(() => callback()).catch(e => {
try {
handleError(e, dir);
} finally {
callback();
}
});
return dir;
});
});
}
function handleError(e, file) {

@@ -101,5 +106,3 @@ if (e.code !== "EPERM" && e.code !== "ENOENT") {

}
getTempFile(options) {
let isDir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
getTempFile(options, isDir = false) {
return tempDir.value.then(it => {

@@ -106,0 +109,0 @@ if (!this.registered) {

{
"name": "temp-file",
"version": "2.0.3",
"version": "2.1.0",
"main": "out/main.js",

@@ -19,16 +19,16 @@ "author": "Vladimir Krivosheev",

"async-exit-hook": "^2.0.1",
"bluebird-lst": "^1.0.3",
"fs-extra-p": "^4.4.0",
"bluebird-lst": "^1.0.5",
"fs-extra-p": "^4.4.4",
"lazy-val": "^1.0.2"
},
"devDependencies": {
"@types/js-yaml": "^3.9.1",
"@types/node": "^8.0.25",
"babel-preset-ts-node4-bluebird": "^0.1.0",
"ts-babel": "^4.1.4",
"typescript": "^2.4.2"
"@types/js-yaml": "^3.10.0",
"@types/node": "^8.0.53",
"babel-preset-ts-node6-bluebird": "^1.0.1",
"ts-babel": "^4.1.8",
"typescript": "^2.6.1"
},
"babel": {
"presets": [
"babel-preset-ts-node4-bluebird"
"babel-preset-ts-node6-bluebird"
]

@@ -35,0 +35,0 @@ },

Sorry, the diff of this file is not supported yet

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