Comparing version 0.3.4 to 0.3.5
26
index.js
@@ -7,3 +7,3 @@ const fs = require('fs') | ||
constructor(path, options = {}) { | ||
if(options.mkdir && !Hotfile.existsSync(path)){ | ||
if (options.mkdir && !Hotfile.existsSync(path)) { | ||
Hotfile.mkdirSync(path) | ||
@@ -77,3 +77,7 @@ } | ||
if ((typeof options.depth === 'number') && !(options.depth >= currentDepth)) continue | ||
await hotfile.loadChildren(options, currentDepth) | ||
try { | ||
await hotfile.loadChildren(options, currentDepth) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
@@ -97,3 +101,7 @@ } | ||
if ((typeof options.depth === 'number') && !(options.depth >= currentDepth)) continue | ||
hotfile.loadChildrenSync(options, currentDepth) | ||
try { | ||
hotfile.loadChildrenSync(options, currentDepth) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
@@ -112,2 +120,10 @@ } | ||
createChildDirectorySync(directoryName) { | ||
const newPath = resolve(this.path, directoryName) | ||
Hotfile.mkdirSync(newPath) | ||
const hotfolder = new Hotfile(newPath) | ||
this.children.push(hotfolder) | ||
return hotfolder | ||
} | ||
async delete() { | ||
@@ -125,3 +141,3 @@ await fs.promises.unlink(this.path) | ||
updateMetadata(newPath){ | ||
updateMetadata(newPath) { | ||
this.path = newPath | ||
@@ -150,3 +166,3 @@ const { name, base, ext } = parse(newPath) | ||
this.updatePath(newPath) | ||
if(await Hotfile.exists(newPath) && !replace) return null | ||
if (await Hotfile.exists(newPath) && !replace) return null | ||
await fs.promises.rename(oldPath, newPath) | ||
@@ -153,0 +169,0 @@ return this |
{ | ||
"name": "hotfile", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "Hotfile makes working with folders and files in node-js easy and clear.", | ||
@@ -5,0 +5,0 @@ "main": "index.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
14243
173