Good afternoon, ladies and gentlemen. I write for myself a module on node js, I can not implement the save () function
module.exports = function(filename, callback){
this.callback = callback(require(filename));
return {
save: function() {
console.log(this);
//fs.writeFile(filename, 'Hello Node.js');
}
};
}
File('file.json', function(data){
data['blablabla'] = 12345;
}).save();
How from a callback, to transfer the changed copy of a file in save (), and there already to save it through fs? I'm interested in the implementation of the fluent-ffmpeg function save ()
ffmpeg('/path/to/file.avi')
.videoCodec('libx264')
.audioCodec('libmp3lame')
.size('320x240')
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})
.save('/path/to/output.mp4');
And as well as implemented on()?
on('end'),
on('error'),
on('response'),
I will be grateful for the information provided.
via CHBS
No comments:
Post a Comment