我正在构建一个网络应用程序,它在终端上运行某些命令并将结果显示回网络应用程序上。我能够使用 child_process.exec 运行命令并获取我面临的问题的结果,同时将其显示在 html 页面上。
I want something like this:
有什么办法可以显示这样的命令行输出吗?任何线索都可以。谢谢。
要在浏览器或 Web 应用程序中获得类似终端/shell/控制台的体验,请查看...
JS 解决方案,用于交互
- https://xtermjs.org https://xtermjs.org
- https://github.com/chjj/tty.js https://github.com/chjj/tty.js
- http://sdether.github.io/josh.js http://sdether.github.io/josh.js
- https://terminal.jcubic.pl/ https://terminal.jcubic.pl/
- https://github.com/liftoff/GateOne https://github.com/liftoff/GateOne
- https://github.com/1j01/simple-console https://github.com/1j01/simple-console
- https://www.masswerk.at/termlib/index.html https://www.masswerk.at/termlib/index.html
仅 HTML/CSS 解决方案,用于非交互性
要模拟没有连接或交互性的终端:
- https://github.com/ines/termynal https://github.com/ines/termynal
- https://github.com/tj/node-term-css https://github.com/tj/node-term-css
- https://guides.codechewing.com/mac-terminal-shell-css-html https://guides.codechewing.com/mac-terminal-shell-css-html
或者也许从头开始使用黑色背景、白色等宽字体,然后从那里开始构建......
CodePen https://codepen.io/MarsAndBack/pen/oJBXpN
#container {
background-color: #000000;
width: 100%;
height: 100%;
max-width: 400px;
max-height: 400px;
padding: 3em;
}
#content {
color: #ffffff;
font-size: 16px;
font-family: monospace;
}
<div id="container">
<div id="content">
<p>Hello world</p>
<p>Hello world</p>
<p>Hello world</p>
<p>Hello world</p>
</div>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)