Comparing version 0.1.1 to 0.1.2
@@ -54,3 +54,4 @@ const p = require('path') | ||
const Hotfolder = require('./Hotfolder') | ||
if(instance != null && (!(instance instanceof Hotfolder) || !(instance instanceof Hotfile))) | ||
console.log({i:instance instanceof Hotfolder}) | ||
if(instance && (!(instance instanceof Hotfolder) && !(instance instanceof Hotfile))) | ||
throw(new Error(`moveTo() expects Hotfolder instace or null, ${instance} provided`)) | ||
@@ -57,0 +58,0 @@ let destDir = this.parent |
@@ -24,3 +24,3 @@ const p = require('path') | ||
const path = p.join(this.path, name) | ||
if(!force && await this.exists(path)) return null | ||
if(!force && await this.exists(path)) return new Hotfile(path) | ||
await fs.promises.appendFile(path, data) | ||
@@ -34,4 +34,5 @@ const file = new Hotfile(path) | ||
const path = p.join(this.path, name) | ||
const { force } = options | ||
await this.mkdir(path, options) | ||
if(!force && await this.exists(path)) return null | ||
if(!force && await this.exists(path)) return new Hotfolder(path) | ||
const folder = new Hotfolder(path) | ||
@@ -38,0 +39,0 @@ this.children.push(folder) |
{ | ||
"name": "hotfile", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
28
test.js
@@ -1,17 +0,17 @@ | ||
const Hotile = require('./index') | ||
const dd = (val) => console.log(val) | ||
const p = require('path') | ||
const Hotfile = require('./index') | ||
const dirpath = p.resolve(__dirname, '../', 'dirtest') | ||
global.z = (v) => console.log(v) | ||
const { Hotfolder, Hotfile, Hot } = require('./index') | ||
// const myfolder = require('hotfile')('./myfolder') | ||
const dirpath = './myfolder' | ||
const filepath = './myfile.txt' | ||
const myfolder = new Hotfolder(dirpath) | ||
const myfile = new Hotfile(filepath) | ||
const run = async () => { | ||
const map = await Hotfile.map(dirpath, { | ||
exclude: [ | ||
/(^|\/)\.[^\/\.]/g, | ||
/@eaDir/g, | ||
] | ||
}) | ||
dd({map}) | ||
const someAsyncFucn = async () => { | ||
// create sub-folders | ||
const subfolder = await myfolder.createFolder('subfolder-05') | ||
// const subfolder2 = await subfolder.createFolder('subfolder-04') | ||
const file = await subfolder.create('summer.js') | ||
await file.setNameTo('water').moveTo(subfolder) | ||
} | ||
run() | ||
someAsyncFucn() |
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
10089
8
191