hotfile
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -78,8 +78,9 @@ const p = require('path') | ||
async moveTo(toPath){ | ||
async moveTo(toPath, name){ | ||
if(toPath instanceof Hotfile) { | ||
if(!toPath.isDirectory) throw('you can not move to a file, please provide a directory path') | ||
toPath = toPath.path | ||
toPath = name ? p.join(toPath.parent, name) : toPath.path | ||
} | ||
if(!p.extname(toPath)) toPath = p.join(toPath, this.filename()) | ||
if(await this.exists(toPath)) return false | ||
return fs.promises.rename(this.path, toPath).then(async () => { | ||
@@ -86,0 +87,0 @@ await Object.assign(this, new Hotfile(toPath)) |
{ | ||
"name": "hotfile", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6979
92