Skip to content
This repository has been archived by the owner on Jun 28, 2019. It is now read-only.
/ managed-folder Public archive

📂 emit namespaced events with a when the files inside a managed subfolder change

License

Notifications You must be signed in to change notification settings

vibedrive/managed-folder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

managed-folder

Create subfolders inside a given folder and emit a namespaced event when a change happens inside any of them.

Currently handles 3 types of events: add, remove, change. Can be passed a map of namespace to folder name as an option.

// default subfolder map (namespace -> folder name)
{
  inbox: 'Inbox'
}

usage

var Folder = require('managed-folder')
var opts = {
  appdir: '/Users/kareniel/Vibedrive',
  subfolders: { inbox: 'Inbox' }
}

var folder = Folder(opts)

folder.on('ready', function () {
  folder.on('inbox:add' function (filepath) {
    console.log('file added to inbox folder:', filepath)
  })
})

api

folder.on(eventName, callback) register an event handler. events are named after the subfolder's key followed by add, remove or change ie: mySubfolder:add

folder.subfolder(key) return the full path to a given subfolder key


if used from the command line you can pass opts either

  1. through cli arguments
node managed-folder --appdir /Users/kareniel/Vibedrive

or

  1. with a config file (/.config)
appdir=/Users/kareniel/Vibedrive

About

📂 emit namespaced events with a when the files inside a managed subfolder change

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published