🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

write-file-atomic

Package Overview
Dependencies
Maintainers
9
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

write-file-atomic - npm Package Compare versions

Comparing version

to
3.0.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# 3.0.0
* Implement options.tmpfileCreated callback.
* Drop Node.js 6, modernize code, return Promise from async function.
* Support write TypedArray's like in node fs.writeFile.
* Remove graceful-fs dependency.
# 2.4.3

@@ -2,0 +9,0 @@

15

index.js

@@ -106,3 +106,5 @@ 'use strict'

await promisify(fs.close)(fd)
fd = null
if (options.chown) {

@@ -117,4 +119,2 @@ await promisify(fs.chown)(tmpfile, options.chown.uid, options.chown.gid)

await promisify(fs.rename)(tmpfile, truename)
removeOnExitHandler()
} finally {

@@ -181,2 +181,3 @@ if (fd) {

let threw = true
try {

@@ -199,7 +200,8 @@ fd = fs.openSync(tmpfile, 'w', options.mode)

fs.closeSync(fd)
fd = null
if (options.chown) fs.chownSync(tmpfile, options.chown.uid, options.chown.gid)
if (options.mode) fs.chmodSync(tmpfile, options.mode)
fs.renameSync(tmpfile, filename)
removeOnExitHandler()
} catch (err) {
threw = false
} finally {
if (fd) {

@@ -213,5 +215,6 @@ try {

removeOnExitHandler()
cleanup()
throw err
if (threw) {
cleanup()
}
}
}

2

package.json
{
"name": "write-file-atomic",
"version": "3.0.0",
"version": "3.0.1",
"description": "Write files in an atomic fashion w/configurable ownership",

@@ -5,0 +5,0 @@ "main": "index.js",