Closed arielfernando closed 6 years ago
Can you paste in the error you're seeing? I see no issue with MjpegCamera in node v10 when using it on its own.
maybe the error is using both (MjpegCamera and pg) at the same time. One thing more, I am running this example on beaglebone black with debian and kernel 4.9.105-ti-r113 The error happens only when you require MjpegCamera module. This is the output running the example
query:SELECT NOW() as now; Pool { _events: {}, _eventsCount: 0, maxListeners: undefined, options: { Client: { [Function: Client] super: [Function], Query: [Function] }, user: 'userDB', database: 'DB', password: 'passDB', port: 5432, host: 'localhost', max: 15, idleTimeoutMillis: 3000 }, log: [Function], Client: { [Function: Client] super: { [Function: EventEmitter] EventEmitter: [Circular], usingDomains: false, defaultMaxListeners: [Getter/Setter], init: [Function], listenerCount: [Function] }, Query: { [Function: Query] super: [Function] } }, Promise: [Function: Promise], _clients: [], _idle: [], _pendingQueue: [], _endCallback: undefined, ending: false } /root/test/node_modules/pg/lib/connection.js:649 var end = buffer.indexOf(0, start) ^
TypeError: Second argument must be a string or a buffer.
at Connection.parseCString (/root/test/node_modules/pg/lib/connection.js:649:20)
at Connection.parseE (/root/test/node_modules/pg/lib/connection.js:548:30)
at Connection.parseMessage (/root/test/node_modules/pg/lib/connection.js:378:19)
at Socket.
Ah, the issue is this line in the mjpeg-consumer library. If removed, everything works.
When I originally wrote these libraries, node.js Buffers did not have .indexOf(), hence the use of buffertools which is no longer necessary.
Feel free to open a PR to mjpeg-consumer or fork both mjpeg-camera and mjpeg-consumer to update them. I'm unable to make changes to these packages at this time.
Thanks for you help.
Ariel
El El jue, 27 sep. 2018 a las 00:14, Mike Maelzer notifications@github.com escribió:
Ah, the issue is this line https://github.com/mmaelzer/mjpeg-consumer/blob/master/lib/mjpeg-consumer.js#L3 in the mjpeg-consumer library. If removed, everything works.
When I originally wrote these libraries, node.js Buffers did not have .indexOf(), hence the use of buffertools which is no longer necessary.
Feel free to open a PR to mjpeg-consumer or fork both mjpeg-camera and mjpeg-consumer to update them. I'm unable to make changes to these packages at this time.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mmaelzer/mjpeg-camera/issues/9#issuecomment-424944944, or mute the thread https://github.com/notifications/unsubscribe-auth/AMey1auNvKx75-PiUGVsamn4NxFNaN4Tks5ufEKXgaJpZM4W4yyq .
I have an error importing this module and pg using Node 10.x an example is:
const pg_1 = require("pg"); var MjpegCamera = require('mjpeg-camera');
async function getNow() { let pg = new pg_1.Pool({ user: 'userDB', database: 'DB', password: 'passDB', port: 5432, host: 'localhost', max: 15, idleTimeoutMillis: 3000, }); let strsql = "SELECT NOW() as now;"; console.log('query:' + strsql); console.log(pg); return await pg.query(strsql); }
getNow();