Socket
Socket
Sign inDemoInstall

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

### Usage


Version published
Maintainers
1
Created
Source

Hotfile

Usage

instantiation
const { Hotfolder, Hotfile, Hot } = require('hotfile')
// const myfolder = require('hotfile')('./myfolder')
const dirpath = './myfolder' 
const filepath = './myfile.txt'
const myfolder = new Hotfolder(dirpath)
const myfile = new Hotfile(filepath)
0. place your code in an asycn function
const someAsyncFucn = async () => {
    // NOTE: all the code below shuold be placed in an asycn function
}

1. Create sub-folders

    const sub1folder = await myfolder.createFolder('subfolder-01')
    const sub2folder = await myfolder.createFolder('subfolder-02')

2. Create file in folder
    const file = await subfolder.create('summer.js')
3. Move file to another folder
    await file.setNameTo('water').setBasenameTo('nemo.mp4').moveTo(sub2folder)
4. Load subfolders with their files
    await myfolder.laodChildren()
5. Load subfolders, their files and for callback for each child
    const cb = async (item) => {
        if(item.isFile){
            // later files here
        }else {
            // later folders here
        }
    } 
    await myfolder.laodChildren({cb})
6. Ignore children that are included
    await myfolder.laodChildren({
        cb,
        exclude: ['node_modules', 'exact_name_of_unwated_file', 'DS_Store']
    })
7. Exclude all hidden files
    await myfolder.laodChildren({
        cb,
        deny: [ /(^|\/)\.[^\/\.]/g, /.*\.mp4/g]
    })

FAQs

Package last updated on 04 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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