Comparing version 0.1.5 to 0.1.6
@@ -507,3 +507,28 @@ const _ = require("lodash"); | ||
return undefined; | ||
}; | ||
}; | ||
/** | ||
* 原路径移动到新路径 | ||
* - 注:在windows下面,C盘或非同盘符的文件是改不了名的 | ||
* @param {String} paramOldFilename | ||
* @param {String} paramNewFilename | ||
* @return {ret: boolean, errInfo: string} 移动结果 | ||
* - ret = true 表示移动成功 | ||
* - ret = false 表示移动失败 | ||
* - errInfo 出错信息 | ||
*/ | ||
static async renameFile(paramOldFilename, paramNewFilename) { | ||
let [error] = await this.WaitClassFunctionEx(fs, 'rename', paramOldFilename, paramNewFilename); | ||
if (utils.isNull(error)) { | ||
return { | ||
ret: true, | ||
errInfo: '', | ||
}; | ||
} else { | ||
return { | ||
ret: false, | ||
errInfo: `rename file fail: ${paramOldFilename}=>${paramNewFilename}: err=${JSON.stringify(error)}`, | ||
} | ||
} | ||
} | ||
/** | ||
@@ -510,0 +535,0 @@ * 创建目录 |
{ | ||
"name": "xmcommon", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "javascript common lib for es6", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -34,6 +34,7 @@ # xmcommon | ||
## 0.1.5 | ||
## 0.1.5 - 0.1.6 | ||
- 2020-12-24 | ||
- \+ 增加fileExists判断文件或目录是否存在 | ||
- \* 修复makedirs存在的bug | ||
- \+ 增加renameFile方法 | ||
@@ -40,0 +41,0 @@ ## 0.1.4 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
140596
4062
235