diff --git a/History.md b/History.md index c2df364..3df6a7f 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,7 @@ +# 1.2.1 / 2020-01-02 +* [F] 修复改回同步时回调未移除, 导致在node v12.10报错的bug + + # 1.2.1 / 2019-08-06 * [U] 写操作改回同步 diff --git a/index.js b/index.js index aede7f6..6487cac 100644 --- a/index.js +++ b/index.js @@ -9,12 +9,6 @@ const FS = require('fs') const PATH = require('path') -const ERROR_FN = (err, res) => { - if (err) { - console.error(err) - } -} - const Iofs = { origin: FS, @@ -94,15 +88,15 @@ const Iofs = { } if (!!append) { - FS.appendFileSync(file, data, opt, ERROR_FN) + FS.appendFileSync(file, data, opt) } else { - FS.writeFileSync(file, data, opt, ERROR_FN) + FS.writeFileSync(file, data, opt) } }, //修改权限 chmod(path, mode) { - FS.chmodSync(path, mode, ERROR_FN) + FS.chmodSync(path, mode) }, /** @@ -152,9 +146,9 @@ const Iofs = { list.forEach(it => { this.rm(it, this.isdir(it)) }) - FS.rmdirSync(origin, ERROR_FN) + FS.rmdirSync(origin) } else { - FS.unlinkSync(origin, ERROR_FN) + FS.unlinkSync(origin) } }, @@ -196,7 +190,7 @@ const Iofs = { this.mkdir(updir) } - FS.mkdirSync(dir, ERROR_FN) + FS.mkdirSync(dir) }, /** diff --git a/package.json b/package.json index 65eedd7..c98dc16 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,19 @@ { "name": "iofs", - "version": "1.2.1", + "version": "1.2.2", "description": "Base on native fs module, for easy using.", "main": "index.js", "repository": { "type": "git", "url": "https://github.com/yutent/iofs.git" }, - "keywords": ["fivejs", "fs", "iofs", "fs.io", "file"], + "keywords": [ + "fivejs", + "fs", + "iofs", + "fs.io", + "file" + ], "author": "yutent", "license": "MIT" }