Create observable file system scopes using observ/unidirectional pattern.
Install via npm
$ npm install observ-fs
var ObservDirectory = require('observ-fs/directory')
Create a directory observer. All arguments are optional. The directory will not be created if it doesn't exist, instead `null' will be emitted as value.
Emits a list of all files and sub-directories in path
whenever any child changes.
Change the target of the directory observer. cb
called after refresh.
Reload children and emit result (also calls cb
with directory
instance on load).
Stop watching.
Get notified by callback
when the directory is closed.
var ObservFile = require('observ-fs/file')
Create a file observer. Unlike ObservDirectory
, the path cannot be changed later but the file will be created if it doesn't exist.
Any changes made to the file will be emitted.
Update the file with data
specified.
Reload the file from disk and emit the data.
Delete the file stored on disk and close all other watchers.
Close the watcher.
Get notified by callback
when the file is closed.