fix deprecared warning with fs.unlink

Since NodeJS 7,  call async api without callback is deprecared.
This commit is contained in:
Meeeeow 2017-04-20 23:33:28 +08:00
parent 62ef3d91b6
commit ea4f8474c1
1 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ function tempFile(str) {
function renameTmp(src, dst, _cb) { function renameTmp(src, dst, _cb) {
function cb(err) { function cb(err) {
if (err) fs.unlink(src) if (err) fs.unlink(src, function() {})
_cb(err) _cb(err)
} }
@ -31,7 +31,7 @@ function renameTmp(src, dst, _cb) {
var tmp = tempFile(dst) var tmp = tempFile(dst)
fs.rename(dst, tmp, function(err) { fs.rename(dst, tmp, function(err) {
fs.rename(src, dst, cb) fs.rename(src, dst, cb)
if (!err) fs.unlink(tmp) if (!err) fs.unlink(tmp, function () {})
}) })
} }