write-file-atomic
Advanced tools
Comparing version 1.3.0 to 1.3.1
16
index.js
'use strict' | ||
module.exports = writeFile | ||
module.exports.sync = writeFileSync | ||
module.exports._getTmpname = getTmpname // for testing | ||
var fs = require('graceful-fs') | ||
@@ -8,7 +12,11 @@ var chain = require('slide').chain | ||
var invocations = 0 | ||
var getTmpname = function (filename) { | ||
return filename + '.' + MurmurHash3(__filename).hash(process.pid).hash(++invocations).result() | ||
function getTmpname (filename) { | ||
return filename + '.' + | ||
MurmurHash3(__filename) | ||
.hash(String(process.pid)) | ||
.hash(String(++invocations)) | ||
.result() | ||
} | ||
module.exports = function writeFile (filename, data, options, callback) { | ||
function writeFile (filename, data, options, callback) { | ||
if (options instanceof Function) { | ||
@@ -58,3 +66,3 @@ callback = options | ||
module.exports.sync = function writeFileSync (filename, data, options) { | ||
function writeFileSync (filename, data, options) { | ||
if (!options) options = {} | ||
@@ -61,0 +69,0 @@ try { |
{ | ||
"name": "write-file-atomic", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Write files in an atomic fashion w/configurable ownership", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6176
91