node-oj-stdin

1.0.1 • Public • Published

node-oj-stdin

为方便使用 node 来写 oj,开发的辅助工具包

安装

npm i node-oj-stdin

使用

getLine

@return string | null

读入一行文本,遇到 EOF 返回 null(EOF 是 linux 文件结束符)

const { getLine, close } = require("node-oj-stdin");

async function main() {
  let str;
  while ((str = await getLine())) {
    console.log(str);
  }
  close();
}

main();

当读到 EOF 的时候会返回 null,最后需要调用 close 关闭

Readme

Keywords

Package Sidebar

Install

npm i node-oj-stdin

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

173 kB

Total Files

75

Last publish

Collaborators

  • mark_npm