Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hotfile

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hotfile - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

myfile.txt

3

models/Hotfile.js

@@ -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",

@@ -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()
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc