diff options
author | Filip Weiss <me@fiws.net> | 2014-09-12 14:43:19 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-09-19 09:42:28 +0400 |
commit | 17c941a2d583210fe97ed47e2968d94ce9f774ba (patch) | |
tree | b4ec50ca5d84cf93f688d0c10a9cfdeba14ffe1c /lib/cache/add-local-tarball.js | |
parent | f2d2190aa365d22378d03afab0da13f95614a583 (diff) |
use writeFileAtomic instead of fs.writeFile fixes #6163
Diffstat (limited to 'lib/cache/add-local-tarball.js')
-rw-r--r-- | lib/cache/add-local-tarball.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/cache/add-local-tarball.js b/lib/cache/add-local-tarball.js index f7cd76103..ad8563800 100644 --- a/lib/cache/add-local-tarball.js +++ b/lib/cache/add-local-tarball.js @@ -1,6 +1,7 @@ var mkdir = require("mkdirp") , assert = require("assert") , fs = require("graceful-fs") + , writeFileAtomic = require("write-file-atomic") , readJson = require("read-package-json") , log = require("npmlog") , path = require("path") @@ -118,7 +119,7 @@ function addPlacedTarball_ (p, pkgData, uid, gid, resolvedSum, cb) { if (er) return cb(er) var pj = path.join(folder, "package.json") var json = JSON.stringify(pkgData, null, 2) - fs.writeFile(pj, json, "utf8", function (er) { + writeFileAtomic(pj, json, function (er) { cb(er, pkgData) }) }) |