Comparing version 0.0.0 to 0.0.1
19
index.js
@@ -27,3 +27,3 @@ const p = require('path') | ||
return fs.promises.mkdir(path, { recursive: true }) | ||
.then(() => true).catch(() => false) | ||
.then(() => new Hotfile(path)).catch(() => false) | ||
} | ||
@@ -54,4 +54,4 @@ | ||
toPath = toPath + '/' + this.filename() | ||
return fs.promises.rename(this.path, toPath).then(() => { | ||
Object.assign(this, new Hotfile(toPath)) | ||
return fs.promises.rename(this.path, toPath).then(async () => { | ||
await Object.assign(this, new Hotfile(toPath)) | ||
return true | ||
@@ -62,6 +62,9 @@ }).catch(() => false) | ||
async move(toPath){ | ||
return fs.promises.rename(this.path, toPath).then(() => { | ||
Object.assign(this, new FileManager(toPath)) | ||
return fs.promises.rename(this.path, toPath).then(async () => { | ||
await Object.assign(this, new Hotfile(toPath)) | ||
return true | ||
}).catch(() => false) | ||
}).catch((err) => { | ||
console.log(err) | ||
return false | ||
}) | ||
} | ||
@@ -81,4 +84,4 @@ | ||
async delete(){ | ||
return fs.promises.unlink(this.path).then(() => { | ||
Object.assign(this,{parent: null, path: null, name: null, metadata: null}) | ||
return fs.promises.unlink(this.path).then(async () => { | ||
await Object.assign(this,{parent: null, path: null, name: null, metadata: null}) | ||
return true | ||
@@ -85,0 +88,0 @@ }).catch(() => false) |
{ | ||
"name": "hotfile", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,3 +21,3 @@ # hotfile | ||
const hotfile = new hf(file) | ||
await hotfile.movieTo(hotdir) | ||
await hotfile.moveTo(hotdir) | ||
``` |
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
3745
76