Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

use writeFileAtomic instead of fs.writeFile fixes #6163 #6182

Closed
wants to merge 1 commit into from

Conversation

fiws
Copy link
Contributor

@fiws fiws commented Sep 13, 2014

I tried to strictly follow the tasks in #6163.

This is my first attempt to contribute to npm so I might completely messed up.
At least the tests are still passing for me after my commit.


var done = inflight(pj, cb)

if (!done) return undefined

fs.writeFile(tmp, JSON.stringify(data), "utf8", function (er) {
getStat(function (er, cs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This getStat is unnecessary - writeFileAtomic will take care of this for you.

@othiym23
Copy link
Contributor

Adopt that change, and this looks good to go! Thank you!

@fiws
Copy link
Contributor Author

fiws commented Sep 16, 2014

Alright, changed that and rebased from master.

@othiym23
Copy link
Contributor

Landed in 17c941a. Thanks so much for contributing this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants