Skip to content

anephenix/poller

Repository files navigation

Poller

NPM version Node.js CI Socket Badge

A FileSystem poller for Node.js.

Dependencies

  • Node.js (v22+)

Install

npm install poller

Usage

// Require the library
const poller = require('poller');

// Poll a file directory
poller('/tmp/myFolder', (err, poll) => {
	// Log every time a file is added into the folder
	poll.on('add', filePath => {
		console.log(filePath, 'was added');
	});

	// Log every time a file is removed from the folder
	poll.on('remove', filePath => {
		console.log(filePath, 'was removed');
	});

	// Stop polling the folder for file adds/removals
	poll.close();
});

// Poll a file directory at an interval of 50ms (the default is 100ms)
poller('/tmp/myFolder', { interval: 50 }, (err, poll) => {});

Licence and Rights

© 2025 Anephenix OÜ. Poller is licenced under the MIT license.

About

A FileSystem poller for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •