From 4c949fadd7e41047cc07d1b788475e9fb0445bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Thu, 2 Jan 2020 14:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=94=B9=E5=9B=9E=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=97=B6=E5=9B=9E=E8=B0=83=E6=9C=AA=E7=A7=BB=E9=99=A4?= =?UTF-8?q?,=20=E5=AF=BC=E8=87=B4=E5=9C=A8node=20v12.10=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- History.md | 4 ++++ index.js | 18 ++++++------------ package.json | 10 ++++++++-- 3 files changed, 18 insertions(+), 14 deletions(-) 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" }