Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

File system watcher based on NSFW that emits add/change/rename/unlink events.

License

Notifications You must be signed in to change notification settings

fabiospampinato/nsfw-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSFW Watcher

File system watcher based on NSFW that emits add/change/rename/unlink events.

Install

npm install --save nsfw-watcher

API

This library provides the following interface:

type Options = {
  debounceMS?: number,
  errorCallback?: Function
};

type Handlers = {
  add?: ( filePath: string ) => void,
  change?: ( filePath: string ) => void,
  rename?: ( prevFilePath: string, nextFilePath: string ) => void,
  unlink?: ( filePath: string ) => void
};

type Listener = {
  start (): Promise<void>,
  stop (): Promise<void>
};

function watcher ( path: string, options: Options, handlers: Handlers ): Promise<Listener>;

Usage

import watcher from 'nsfw-watcher';

const handlers = {
  add ( filePath ) { /* ... */ },
  change ( filePath ) { /* ... */ },
  rename ( prevFilePath, nextFilePath ) { /* ... */ },
  unlink ( filePath ) { /* ... */ }
};

watcher ( '/Users/fabio/Desktop', {}, handlers );

License

MIT © Fabio Spampinato

About

File system watcher based on NSFW that emits add/change/rename/unlink events.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published