Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deiga/peep
Peep is a smart fs.watch wrapper which is lighter and faster
https://github.com/deiga/peep
Last synced: 11 days ago
JSON representation
Peep is a smart fs.watch wrapper which is lighter and faster
- Host: GitHub
- URL: https://github.com/deiga/peep
- Owner: deiga
- License: other
- Created: 2014-06-10T05:56:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-06-02T12:40:02.000Z (over 3 years ago)
- Last Synced: 2024-11-16T23:02:43.658Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://www.npmjs.org/package/peep
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# Peep
Peep is a smart `fs.watch` wrapper which is lighter and faster. It uses as little `fs.FSWatcher`s as possible, and can prevent duplicate watching.
Peep has a better `.add()` method which can automatically detect nested structures between the current watched files and directories, and choose the best strategy to make it fast and use less resources.
## Installation
npm install peep --save
## Usage```js
var peep = require('peep')();peep
.on('all', function(event, path){
console.log(event, path);
})
.add('test/foo.js')
.add('test') // 'test' contains 'test/foo.js'
```Peep doesn't depend on `'globule'` module. If you prefer the feature of globbing files, you could do this:
```js
var globule = require('globule');peep.add( globule.find('test/**/*.js') );
```## Methods
#### peep.add(path[, path, ...])
#### peep.add(paths)Adds file(s) or directories to be watched
```js
peep.add('test/foo.js', 'test/foo2.js');
peep.add(['test/foo.js', 'test/foo2.js']);
```#### peep.remove(path[, path, ...])
#### peep.remove(paths)Removes file(s) or directories from being watched.
#### peep.remove()
Removes all watched files and directories.#### peep.watched()
##### Returns `Array.`
The current watched files.
## Events
What's coming...