write-file-atomic
Advanced tools
Comparing version 4.0.1 to 4.0.2
@@ -42,3 +42,5 @@ 'use strict' | ||
fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) | ||
} catch (_) {} | ||
} catch { | ||
// ignore errors | ||
} | ||
} | ||
@@ -160,3 +162,3 @@ } | ||
function writeFile (filename, data, options, callback) { | ||
async function writeFile (filename, data, options, callback) { | ||
if (options instanceof Function) { | ||
@@ -169,3 +171,8 @@ callback = options | ||
if (callback) { | ||
promise.then(callback, callback) | ||
try { | ||
const result = await promise | ||
return callback(result) | ||
} catch (err) { | ||
return callback(err) | ||
} | ||
} | ||
@@ -172,0 +179,0 @@ |
{ | ||
"name": "write-file-atomic", | ||
"version": "4.0.1", | ||
"version": "4.0.2", | ||
"description": "Write files in an atomic fashion w/configurable ownership", | ||
@@ -9,4 +9,4 @@ "main": "./lib/index.js", | ||
"posttest": "npm run lint", | ||
"lint": "eslint '**/*.js'", | ||
"postlint": "npm-template-check", | ||
"lint": "eslint \"**/*.js\"", | ||
"postlint": "template-oss-check", | ||
"preversion": "npm test", | ||
@@ -17,7 +17,7 @@ "postversion": "npm publish", | ||
"snap": "tap", | ||
"template-copy": "npm-template-copy --force" | ||
"template-oss-apply": "template-oss-apply --force" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/npm/write-file-atomic.git" | ||
"url": "https://github.com/npm/write-file-atomic.git" | ||
}, | ||
@@ -39,18 +39,20 @@ "keywords": [ | ||
"devDependencies": { | ||
"@npmcli/template-oss": "^2.7.1", | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.5.0", | ||
"mkdirp": "^1.0.4", | ||
"rimraf": "^3.0.2", | ||
"tap": "^15.1.6" | ||
"tap": "^16.0.1" | ||
}, | ||
"files": [ | ||
"bin", | ||
"lib" | ||
"bin/", | ||
"lib/" | ||
], | ||
"engines": { | ||
"node": "^12.13.0 || ^14.15.0 || >=16" | ||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" | ||
}, | ||
"templateOSS": { | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"windowsCI": false, | ||
"version": "2.7.1" | ||
"version": "3.5.0" | ||
} | ||
} |
12210
235
5