Git Product home page Git Product logo

node-hound's People

Contributors

artnez avatar beefsack avatar gforceg avatar mortonfox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-hound's Issues

Will there be a typings file?

Hi,

Liking this project, does work very well so far.
As I'm using mainly typescript, it would be nice if there were any typings, but I couldn't find one with typings install hound.

Are you planning to offer a typescript-definition-file or is there some (inofficial?) d.ts?

Thanks!

Multiple files or folders?

Is it possible to pass an array of files or folders to hound.watch? It seems to throw an error. Is there a recommended way to watch multiple src's?

Error when deleting subfolder

I am using hound v1.0.5 and Node.js 8.4.0

This is my code to watch a directory. When I now create a folder in the test directory, the creation of this event gets recognized and works fine. But when I try to delete this folder now an error message appears. See bottom of the page for error message.

`var hound = require('hound');

// Create a directory tree watcher.
watcher = hound.watch('./test');

// Add callbacks for file and directory events. The change event only applies
// to files.
watcher.on('create', function(file, stats) {
console.log(file + ' was created')
});
watcher.on('change', function(file, stats) {
console.log(file + ' was changed')
});
watcher.on('delete', function(file) {
console.log(file + ' was deleted')
});`

Error message:

`events.js:182
throw er; // Unhandled 'error' event
^

Error: Error watching file for changes: EPERM
at _errnoException (util.js:1041:11)
at FSEvent.FSWatcher._handle.onchange (fs.js:1359:9)`

ENOSPC

Hello,

I cannot find why i get the following error.

Error: watch server/prints/agparaskeui/receiptseyp ENOSPC
at exports._errnoException (util.js:870:11)
at FSWatcher.start (fs.js:1234:19)
at fs.watch (fs.js:1262:11)
at Hound.watch (/var/www/bullseye/server/node_modules/hound/hound.js:52:24)
at Object.exports.watch (/var/www/bullseye/server/node_modules/hound/hound.js:18:11)
at printReceiptTxtProduceEyp (/var/www/bullseye/server/config/printNode.js:1334:50)
at WriteStream. (/var/www/bullseye/server/config/printNode.js:1295:25)
at WriteStream.g (events.js:260:16)
at emitNone (events.js:72:20)
at WriteStream.emit (events.js:166:7)
at finishMaybe (_stream_writable.js:468:14)
at afterWrite (_stream_writable.js:347:3)
at onwrite (_stream_writable.js:337:7)
at WritableState.onwrite (_stream_writable.js:89:5)
at fs.js:1911:5
at FSReqWrap.wrapper [as oncomplete] (fs.js:1878:5)

Change event firing twice

Sample program:

var hound = require('hound');

var w = hound.watch('.');

w.on('change', function(file, stats) {
    console.log('changed:', file);
});

Edit any file and the event will fire twice.
Happening on node 0.8 on Ubuntu 11.04.

Doesn't work with Node 0.11.*

When running default example, we get

fs.js:1176
throw errnoException(err, 'watch');
Error: watch EINVAL
at exports._errnoException (util.js:746:11)
at FSWatcher.start (fs.js:1176:11)
at Object.fs.watch (fs.js:1202:11)
at Hound.watch (D:...\node_modules\hound\hound.js:45:27)
at Hound.watch (D:...p\node_modules\hound\hound.js:42:12)
at Object.exports.watch (D:...\node_modules\hound\hound.js:13:11)
at Object. (D:...\index.js:27:17)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)

This certainly seems like a bug in pre-release Node, but I'm not proficient to report it in the required way. Also it seems that hound was meant to be reliable, so you may be interested in this issue.

Cannot watch large directories

Directories with too many files result in this exception for me on OSX with node v0.8.8. In my case, "too many" files is 162 files clocking in at 22.7MB on disk. I'm not sure where the breaking threshold is, but I would hope we can watch directories of this size or greater.

var a = hound.watch('/Users/me/Projects/project')

Error: watch EMFILE
at errnoException (fs.js:806:11)
at FSWatcher.start (fs.js:837:11)
at Object.fs.watch (fs.js:861:11)
at Hound.watch (/XYZ/node_modules/hound/hound.js:45:27)
at Hound.watch (/XYZ/node_modules/hound/hound.js:42:12)
at Hound.watch (/XYZ/node_modules/hound/hound.js:42:12)
at Hound.watch (/XYZ/node_modules/hound/hound.js:42:12)
at Hound.watch (/XYZ/node_modules/hound/hound.js:42:12)
at Hound.watch (/XYZ/node_modules/hound/hound.js:42:12)
at Object.exports.watch (/XYZ/node_modules/hound/hound.js:13:11)

I have gotten around this in the short term by setting up multiple hound watchers for each sub directory within the project.

For comparison, and it might not be an applicable one because of hound's feature-set, nodemon successfully watches directories of this size.

CLI wrapper

Could you provide a command line interface for that package?

path.existsSync deprecated in 0.8

Hound apparently uses a call to path.existsSync in some places. On node 0.8, this throws a warning "path.existsSync is now called fs.existsSync." It looks like this change happened between 0.6 and 0.7.

How about many files?

Not a bug, just a question how hound handles this.
If I watch a folder where a lot of files get copied to, will the processes all run at once? Let's say I copy 200 files in there which should be processed (a deeper processing of the files is done). I've concerns that this blocks CPU or IO. Is it possible to just process a defined number of files at once?

Thanks in advance!

add "var"

watcher and stats should be declared. (per doomslice on reddit)

Error

Hi!

I get this error when I start my script

/node_modules/hound/hound.js:0

^
Error: ENOENT, no such file or directory '/home/1000000900480/VENDOR/450/IN/176537818_�-1331336.txt'
at Object.fs.statSync (fs.js:684:18)
at Hound.watch (/node_modules/hound/hound.js:37:18)
at Hound.watch (/node_modules/hound/hound.js:42:12)
at Hound.watch (/node_modules/hound/hound.js:42:12)
at Hound.watch (/node_modules/hound/hound.js:42:12)
at Hound.watch (/node_modules/hound/hound.js:42:12)
at Hound.watch (/node_modules/hound/hound.js:42:12)
at Object.exports.watch (/node_modules/hound/hound.js:13:11)
at Object. (/home/checkfs3.js:22:17)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)

This file exists in directory.
winscp 2014-03-19 19 39 03

Thanks!

Throws errors when filesystem changes during Hound.prototype.watch

If a file is created and then deleted before Hound.prototype.watch has a chance to execute, then Hound will attempt to stat a non-existent file. All other fs operations run by Hound can also fail under similar circumstances.

I was able to throw in some try-catches to fix the problem but a proper solution depends on what kind of guarantees you want to make about Hound's behavior.

If Hound must report all FS changes, however temporary, then you've got a problem. If a file is created and then deleted before Hound can stat the file, it'll have to fire a 'create' event without any stat data, followed by a 'delete' event.

It's easier if you only require Hound to fire enough events that an observer arrives at a valid view of the eventual steady-state of the filesystem. In other words, if a file is created and then immediately deleted, Hound doesn't need to fire any events. "oops, it was too fast." Of course, if a file is created and remains extant then Hound is required to fire a 'created' event. If the file is modified twice in quick succession, Hound can get away with firing only one 'change' event, provided that event fires after the second file change has completed. For my personal use-case (automatically rebuilding templates & recompiling code as I edit them) this is totally fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.