Lellansin / node-scanf

C like scanf module for node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

encoding : null on RaspberryPi

TigerChi opened this issue · comments

When I use node-scanf on RaspberryPi, has some problem as below.
And solve by modify node-scanf/lib/gets.js : 43
from
var content = buf.toString(null, 0, bytesRead - 1);
to
var content = buf.toString('ascii', 0, bytesRead - 1);

buffer.js:557
throw new TypeError('Unknown encoding: ' + encoding);
^

TypeError: Unknown encoding: null
at stringSlice (buffer.js:557:9)
at Buffer.toString (buffer.js:593:10)
at module.exports (/home/pi/kd/node_modules/scanf/lib/gets.js:43:21)
at getInput (/home/pi/kd/node_modules/scanf/lib/scanf.js:64:15)
at getLine (/home/pi/kd/node_modules/scanf/lib/scanf.js:138:14)
at dealType (/home/pi/kd/node_modules/scanf/lib/scanf.js:169:13)
at module.exports (/home/pi/kd/node_modules/scanf/lib/scanf.js:31:12)
at enterKey (/home/pi/kd/vig.js:54:8)
at MyInput (/home/pi/kd/vig.js:47:2)
at Object. (/home/pi/kd/vig.js:81:1)

I find #11 resolve this problem, but when I use
npm install scanf
still download old version.

Um, sorry for reply later, I'v fixed it by republishing the NPM.
You can renew it by npm install the new version.

Feel free to reopen.

Thanks for reply :)