node-gets
v0.4.0
Published
Synchronously reading a line with Node.js
Downloads
2
Readme
node-gets
Installation
# If you prefer GitHub version
$ npm install --save cwd-k2/node-gets
Usage
const gets = require("node-gets").createGets();
// echo each line from stdin
for (let i = 0; i < 10; i++) {
const str = gets();
console.log(str);
}
Performance Tips
If you have to treat a big amount of input, you can configure the buffer size and chunk size to be big enough.
// For big input
// Second argument: buffer size
// Third argument: chunk size
const gets = require("node-gets").createGets(0, 65536, 8192);
//...