【文件属性】:
文件名称:get-stdin:将stdin作为字符串或缓冲区获取
文件大小:6KB
文件格式:ZIP
更新时间:2021-04-29 11:30:54
JavaScript
get-stdin
将作为字符串或缓冲区获取
安装
$ npm install get-stdin
用法
// example.js
import getStdin from 'get-stdin' ;
console . log ( await getStdin ( ) ) ;
//=> 'unicorns'
$ echo unicorns | node example.js
unicorns
原料药
两种方法都返回一个承诺,当在stdin流上触发end事件时,将解决该承诺,指示不再有要读取的数据。
getStdin()
以string获取stdin 。
在TTY上下文中,返回解析为空string的Promise。
getStdin.buffer()
获取stdin作为Buffer 。
在TTY上下文中,返回解析为空Buffer的Promise。
有关的
以字符串或缓冲区的形
【文件预览】:
get-stdin-main
----.gitignore(23B)
----.github()
--------security.md(179B)
--------workflows()
--------funding.yml(115B)
----.gitattributes(19B)
----test-buffer.js(641B)
----package.json(805B)
----index.test-d.ts(157B)
----test-real.js(167B)
----readme.md(1KB)
----index.js(488B)
----index.d.ts(852B)
----test.js(508B)
----.editorconfig(175B)
----license(1KB)
----.npmrc(19B)