Socket
Socket
Sign inDemoInstall

write-file-atomic

Package Overview
Dependencies
4
Maintainers
9
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 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",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc