You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is the code I have (small changes from existing example)
var fs = require('fs');
var sys = require('sys');
var Png = require('node-png').PNG;
var Buffer = require('buffer').Buffer;
// the rgba-terminal.dat file is 1152000 bytes long.
var rgba = fs.readFileSync('./rgba-terminal.dat');
var png = new Png(rgba, 720, 400, 'rgba');
png.encode(function (data, error) {
if (error) {
console.log('Error: ' + error.toString());
process.exit(1);
}
fs.writeFileSync('./png-async.png', data.toString('binary'), 'binary');
});
The error I get when running this is 👍
% node test-png-1.js
/Users/svarma/projects/charon/charon-server/test-png-1.js:10
png.encode(function (data, error) {
^
TypeError: undefined is not a function
at Object. (/Users/svarma/projects/charon/charon-server/test-png-1.js:10:5)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Anyone had this issue before ? I am not sure what I am missing. The node module is built successfully and installed as "node-png".
Thanks.
The text was updated successfully, but these errors were encountered:
Hi,
Here is the code I have (small changes from existing example)
var fs = require('fs');
var sys = require('sys');
var Png = require('node-png').PNG;
var Buffer = require('buffer').Buffer;
// the rgba-terminal.dat file is 1152000 bytes long.
var rgba = fs.readFileSync('./rgba-terminal.dat');
var png = new Png(rgba, 720, 400, 'rgba');
png.encode(function (data, error) {
if (error) {
console.log('Error: ' + error.toString());
process.exit(1);
}
fs.writeFileSync('./png-async.png', data.toString('binary'), 'binary');
});
The error I get when running this is 👍
% node test-png-1.js
/Users/svarma/projects/charon/charon-server/test-png-1.js:10
png.encode(function (data, error) {
^
TypeError: undefined is not a function
at Object. (/Users/svarma/projects/charon/charon-server/test-png-1.js:10:5)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Anyone had this issue before ? I am not sure what I am missing. The node module is built successfully and installed as "node-png".
Thanks.
The text was updated successfully, but these errors were encountered: