Monday, 15 May 2017

gifencoder on Node throws TypeError

I'm trying to follow the instructions for npm gifencoder

I have the following file structure:

Directly under my project folder, I have a tempDir directory. The node_modules directory is a sister directory.

Below is the code I'm trying to execute

var gifConvert = function(){
    var encoder = new GIFEncoder(300,300);
    pngFileStream('tempDir/*.png') //this is where the console tells me the error is occurring
    .pipe(encoder.createReadStream({repeat:-1, delay:430, quality: 10}))
    .pipe(fs.createWriteStream('../public/generatedCoins/coin_12345.gif'));

}

When I run this I get an error saying dest.on('unpipe, onunpipe) . . . TypeError:undefined is not a function.

I suspect it is how I'm typing in the directory but I have tried all sorts of combinations and get the same result.

Any help greatly appreciated. Thanks!



via martellalex

No comments:

Post a Comment