Comparing version 4.5.3 to 4.5.4
50
index.js
@@ -6,2 +6,4 @@ 'use strict'; | ||
var Debug = require('debug'); | ||
var os = require('os'); | ||
var qiaoEncode = require('qiao-encode'); | ||
var readline = require('readline'); | ||
@@ -38,3 +40,3 @@ | ||
// fs | ||
const debug$6 = Debug('qiao-file'); | ||
const debug$7 = Debug('qiao-file'); | ||
@@ -51,3 +53,3 @@ /** | ||
if (!srcExists) { | ||
debug$6('/ cp / src not exists'); | ||
debug$7('/ cp / src not exists'); | ||
return; | ||
@@ -57,7 +59,7 @@ } | ||
await fsExtra.copy(src, dest); | ||
debug$6('/ cp / success'); | ||
debug$7('/ cp / success'); | ||
return true; | ||
} catch (e) { | ||
debug$6('/ cp / fail'); | ||
debug$7('/ cp / fail'); | ||
console.log(e); | ||
@@ -68,3 +70,3 @@ } | ||
// fs | ||
const debug$5 = Debug('qiao-file'); | ||
const debug$6 = Debug('qiao-file'); | ||
@@ -80,3 +82,3 @@ /** | ||
if (!srcExists) { | ||
debug$5('/ mv / src not exists'); | ||
debug$6('/ mv / src not exists'); | ||
return; | ||
@@ -86,7 +88,7 @@ } | ||
await fsExtra.move(oldPath, newPath, { overwrite: true }); | ||
debug$5('/ mv / success'); | ||
debug$6('/ mv / success'); | ||
return true; | ||
} catch (e) { | ||
debug$5('/ mv / fail'); | ||
debug$6('/ mv / fail'); | ||
console.log(e); | ||
@@ -97,3 +99,3 @@ } | ||
// fs | ||
const debug$4 = Debug('qiao-file'); | ||
const debug$5 = Debug('qiao-file'); | ||
@@ -108,7 +110,7 @@ /** | ||
await fsExtra.remove(fpath); | ||
debug$4('/ rm / success'); | ||
debug$5('/ rm / success'); | ||
return true; | ||
} catch (e) { | ||
debug$4('/ rm / fail'); | ||
debug$5('/ rm / fail'); | ||
console.log(e); | ||
@@ -118,2 +120,27 @@ } | ||
// os | ||
const debug$4 = Debug('qiao-file'); | ||
/** | ||
* mk dir | ||
* @param {*} dir | ||
* @returns | ||
*/ | ||
const tmpdir = async () => { | ||
try { | ||
const tmpPath = os.tmpdir(); | ||
const randomFolder = qiaoEncode.uuid(); | ||
const tmpDir = path.resolve(tmpPath, randomFolder); | ||
debug$4('/ tmpdir / ', tmpDir); | ||
await fsExtra.ensureDir(tmpDir); | ||
debug$4('/ tmpdir / success'); | ||
return true; | ||
} catch (e) { | ||
debug$4('/ tmpdir / fail'); | ||
console.log(e); | ||
} | ||
}; | ||
// fs | ||
@@ -402,2 +429,3 @@ const debug$3 = Debug('qiao-file'); | ||
exports.rm = rm; | ||
exports.tmpdir = tmpdir; | ||
exports.writeFile = writeFile; |
{ | ||
"name": "qiao-file", | ||
"version": "4.5.3", | ||
"version": "4.5.4", | ||
"description": "nodejs file tool", | ||
@@ -51,3 +51,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "0ce84380c667b8b2aa3b5c0dc6448ee42fceae41" | ||
"gitHead": "06a6d5286e0f141aa57e357069ce1bfbba2338f5" | ||
} |
@@ -11,2 +11,3 @@ // fs & path | ||
// dir | ||
export * from './tmpdir.js'; | ||
export * from './mkdir.js'; | ||
@@ -13,0 +14,0 @@ export * from './readdir.js'; |
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
23178
730