# stalker

> Monitor directory trees for new files then do... something.

Latest version **0.0.20** (published 2012-09-28) · 0 weekly downloads

## Install

```sh
npm install stalker
pnpm add stalker
yarn add stalker
bun add stalker
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.20 |
| Published | 2012-09-28 |
| First published | 2011-05-31 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.6 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 50 |
| Author | Justin Slattery |
| Maintainers | jslatts |

## Links

- npm: https://www.npmjs.com/package/stalker
- Repository: https://github.com/jslatts/stalker
- npm.io page: https://npm.io/package/stalker

## Recent versions

- 0.0.20 (latest) — 2012-09-28
- 0.0.19 — 2012-09-12
- 0.0.18 — 2012-09-11
- 0.0.17 — 2012-03-04
- 0.0.15 — 2011-12-29
- 0.0.12 — 2011-07-19
- 0.0.10 — 2011-06-29
- 0.0.9 — 2011-06-21
- 0.0.7 — 2011-06-21
- 0.0.6 — 2011-06-10
- 0.0.5 — 2011-06-09
- 0.0.4 — 2011-06-08
- 0.0.2 — 2011-05-31
- 0.0.1 — 2011-05-31

## README

# Stalker

Stalker is a utility to watch a directory tree for incoming files. When if finds
one, it will fire off a callback function __OF YOUR CHOICE!__

It should be smart enough to handle multiple files/folders being dropped into the 
directory being stalked. 

## Installation

    $ npm install stalker

## How to use

    var stalker = require('stalker');

    stalker.watch('some_directory', function (err, file) {
      console.log('I saw a file. It was going like this: ' + file);
    });

## Options

You can pass in a buffer time in milliseconds to make stalker batch up 
the files and send them back in an array. The timer only starts when a new file
drops.

    stalker.watch('./example', {buffer: 5000}, function(err, f) { 
      f.forEach(function _forEach(_f) {
        console.log('I see ' + _f); 
      });
    });

Setting recurse to false will keep stalker for walking down directories.

    stalker.watch('./example', {recurse: false}, function(err, f) { 
      console.log('I see ' + _f); 
    });

Setting strict to true will make stalker return for modified files.
*This has unpredictable behavior on windows/OSX. I have only used it
on Linux*

    stalker.watch('./example', {strict: true}, function(err, f) { 
      console.log('I see ' + _f); 
    });

Stalker will also take a second callback that will be fired when files are removed:

    stalker.watch('./example', function(err, f) { 
      console.log('Added: ' + f); 
    }, function(err, f) {
      console.log('Removed: ' + f); 
    });

The removal callback also works in batch mode.

## Running tests

I couldn't handle vows.js anymore. I ripped it out. Will replace with something 
else in the future. For now, run example/*.js and play around adding and 
removing files from the example directory:

    node example/test.js

## License 

(The MIT License)

Copyright (c) 2011 Justin Slattery (Justin.Slattery@fzysqr.com)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## Gir
                              :/::-.`                                        
                            .o-```.:+o++//-                                  
                           ++`````--------/o++:`                             
                         .o.````.-------------:++/:---------.`               
                        ++````.-------------------+oo+++++//+oso/:.          
              ://o:   `s-````-----------------------:oo-       `-:+o+.--`    
            -+/::shy:-s````.-------:++++/:-------------+o:           +/:/o`  
           /+::::hhhhy````-----:+++/:::::+++:------------/s-          .::/`  
          o/::::ohhhh+``.----/o+::::::::::::+o:------------+o`               
         o/::::+dhhhd.`.---:o+::::::::::::::::s:------------:s/              
        +/::::/hhhhhs`----/o::::::::::::::::::/y-------------:ss`            
       -+::::/hhhhhh.----/o::::::::::::::::::::m+-----------/oooh-           
       o::::+hhhhhy.-----s::::::::::::::::::::sho---------:/oooooy/          
      .o:::shhhhho`-----:o:::::::::::::::::::odd/--------:+oooooooy/         
      .o/ohhhhhy:`.-----:s:::::::::::::::::/yhho--------/oooooooooy/         
       `------y-``-------o+::::::::::::::/shhh+-------:+ooooooooy+`          
              y``.:oo+:---/o/:::::::::/oyhhhs:-------/ooooooooys.            
              y``-y.o.+o----/ossooosyhhhhyo:-------:+ooooooosy-              
              y``++-/`-Nh------/+osssoo/:--------:/ooooooooy:                
              o-`-sNmhNMMo----------------------/+oooooooy+                  
              `y`.-NMMMMMm--------------------/+oooooooyo`                   
               :+`/MMMMMMh------------------/+oooooooyo`                     
                :o.smNNds:---------------:/+oooooooyo.                       
                 .o/-------------------:/+oooooooy+`                         
                   .+o:-------------:/+oooooooss/`                           
                      :+o+:-----://+oooooooys+.                              
                         `:/+osyssoossyysohdo/`                              
                               `.----.`    ./sds/.                           
                                             .:oymho/:///`                   
                                         `-`+-:sh:-o-:::/s                   
                                        .o+ooos:/s/s:++:+s                   
                                        +h/:yho+/:s/sooyd`                   
                                            .s.:/ooss+yoy                    
                                            /+-////o+soh`                    
                                      `://o+.s/:--:/oyo`                     
                                   .+++:s/.   .//+y/:`                       
                                  /+.-/y-      :o+h                          
                                  y`-:oy+     //--os/`                       
                                  //+oysy`    //.-:+oys+-                    
                                               /+/++oyso:                    
                                                  `.`

---
_Source: https://npm.io/package/stalker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
