Comparing version 0.2.0 to 0.2.1
16
index.js
@@ -127,6 +127,19 @@ 'use strict'; | ||
/** | ||
* mv | ||
* @param {*} oldPath | ||
* @param {*} newPath | ||
*/ | ||
const mv = (oldPath, newPath) => { | ||
try{ | ||
fs.renameSync(oldPath, newPath); | ||
}catch(e){ | ||
console.log(e); | ||
} | ||
}; | ||
/** | ||
* rm | ||
* fpath, file or folder path, folder must end with / | ||
*/ | ||
const rm = (fpath) => { | ||
const rm = (fpath) => { | ||
try{ | ||
@@ -246,3 +259,4 @@ // rm file | ||
exports.mkdir = mkdir; | ||
exports.mv = mv; | ||
exports.readFile = readFile; | ||
exports.rm = rm; |
{ | ||
"name": "qiao-file", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "nodejs file tool", | ||
@@ -24,3 +24,3 @@ "author": "uikoo9 <uikoo9@qq.com>", | ||
}, | ||
"gitHead": "f2e6182e1514994d92f6f492bcfdcdc79e665e35" | ||
"gitHead": "ecc4ad7170e1362a9ef0a26b287b6db01425ee24" | ||
} |
@@ -24,2 +24,18 @@ # qiao-file | ||
### mv | ||
```javascript | ||
'use strict'; | ||
var q = require('qiao-file'); | ||
var test = function(){ | ||
var oldPath = './test'; | ||
var newPath = './test1' | ||
q.mv(oldPath, newPath); | ||
}; | ||
test(); | ||
``` | ||
### rm | ||
@@ -142,2 +158,3 @@ ```javascript | ||
1. lstree path name | ||
2. mv | ||
@@ -144,0 +161,0 @@ ### 0.1.2.20220419 |
@@ -32,6 +32,19 @@ 'use strict'; | ||
/** | ||
* mv | ||
* @param {*} oldPath | ||
* @param {*} newPath | ||
*/ | ||
export const mv = (oldPath, newPath) => { | ||
try{ | ||
fs.renameSync(oldPath, newPath); | ||
}catch(e){ | ||
console.log(e); | ||
} | ||
}; | ||
/** | ||
* rm | ||
* fpath, file or folder path, folder must end with / | ||
*/ | ||
export const rm = (fpath) => { | ||
export const rm = (fpath) => { | ||
try{ | ||
@@ -38,0 +51,0 @@ // rm file |
16264
20
543
203