Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

write-file-atomic

Package Overview
Dependencies
Maintainers
3
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 2.4.0 to 2.4.1

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 2.4.1
* Fix a bug where `signal-exit` instances would be leaked. This was fixed when addressing #35.
# 2.4.0

@@ -2,0 +6,0 @@

17

index.js

@@ -61,3 +61,4 @@ 'use strict'

var tmpfile
var removeOnExit = cleanupOnExit(() => tmpfile)
/* istanbul ignore next -- The closure only gets called when onExit triggers */
var removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile))
var absoluteName = path.resolve(filename)

@@ -158,5 +159,6 @@

}).then(function success () {
removeOnExitHandler()
callback()
}).catch(function fail (err) {
removeOnExit()
}, function fail (err) {
removeOnExitHandler()
fs.unlink(tmpfile, function () {

@@ -201,3 +203,4 @@ callback(err)

var removeOnExit = onExit(cleanupOnExit(tmpfile))
var cleanup = cleanupOnExit(tmpfile)
var removeOnExitHandler = onExit(cleanup)
var fd = fs.openSync(tmpfile, 'w', options.mode)

@@ -216,8 +219,8 @@ if (Buffer.isBuffer(data)) {

fs.renameSync(tmpfile, filename)
removeOnExit()
removeOnExitHandler()
} catch (err) {
removeOnExit()
try { fs.unlinkSync(tmpfile) } catch (e) {}
removeOnExitHandler()
cleanup()
throw err
}
}
{
"name": "write-file-atomic",
"version": "2.4.0",
"version": "2.4.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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc