Created
November 5, 2019 15:54
-
-
Save bkeating/9d12a3df75143f509b5419f5e26aec7f to your computer and use it in GitHub Desktop.
nvAux - FIle System Storage Plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chokidar = require('chokidar'); | |
// Initialize watcher. | |
const watcher = chokidar.watch('/Users/kea1080/Documents/nmdiary', { | |
ignored: /(^|[\/\\])\../, // ignore dotfiles | |
persistent: true | |
}); | |
// Something to use when events are received. | |
const log = console.log.bind(console); | |
// Add event listeners. | |
watcher | |
.on('add', path => log(`File ${path} has been added`)) | |
.on('change', path => log(`File ${path} has been changed`)) | |
.on('unlink', path => log(`File ${path} has been removed`)); | |
// Get list of actual paths being watched on the filesystem | |
// setInterval(() => { | |
// var watchedPaths = watcher.getWatched(); | |
// log(watchedPaths); | |
// }, 3000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "nv-storage-fs", | |
"version": "1.0.0", | |
"description": "file system superpowers", | |
"main": "index.js", | |
"author": "Ben Keating", | |
"license": "MIT", | |
"dependencies": { | |
"chokidar": "^3.3.0" | |
}, | |
"prettier": { | |
"singleQuote": true | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment