Answer the question
In order to leave comments, you need to log in
How to pass data to Kue?
Good afternoon.
I want to make a small service for converting video files on Node JS.
At the same time I want to learn a little programming in Node.
Essence of the question:
There is a watcher.js script:
var chokidar = require('chokidar');
var watcher = chokidar.watch('mediafiles', {
ignored: /[\/\\]\./, persistent: true
});
var log = console.log.bind(console);
watcher
.on('add', function(path) { log('File', path, 'has been added'); })
.on('addDir', function(path) { log('Directory', path, 'has been added'); })
.on('change', function(path) { log('File', path, 'has been changed'); })
.on('unlink', function(path) { log('File', path, 'has been removed'); })
.on('unlinkDir', function(path) { log('Directory', path, 'has been removed'); })
.on('error', function(error) { log('Error happened', error); })
.on('ready', function() { log('Initial scan complete. Ready for changes.'); })
.on('raw', function(event, path, details) { log('Raw event info:', event, path, details); })
// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', function(path, stats) {
if (stats) console.log('File', path, 'changed size to', stats.size);
});
// Un-watch some files.
watcher.unwatch('/Users/slava/test_project/mediafiles/.DS_Store');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question