node.js 控制台
Introducing colors into the command line makes console reading much easier which is why finding Chalk was a life-changing event for me. I started digging deeper into making the console more graphical and I found another module that could bring the console to life: console-png!
在命令行中引入颜色可以使控制台阅读更加容易,这就是为什么找到Chalk对我来说是改变生活的事件。 我开始更深入地研究,使控制台更加图形化,我发现了另一个可以使控制台栩栩如生的模块: console-png !
Assuming you've installed console-png or grabbed it from GitHub, it doesn't take much to output an image to the console:
假设您已经安装了console-png或从GitHub上获取了它,那么将图像输出到控制台并不需要很多:
// Attach module to the console require('console-png').attachTo(console); // Read the image, let console-png output it to console console.png(require('fs').readFileSync(__dirname + '/logo.png'));As for the use case of such a module, there probably aren't a ton. It would be useful to show a command line splash screen when an app starts up, and it may be useful as a feedback mechanism as the user follows app flow.
至于这种模块的用例,可能没有很多。 当应用程序启动时显示命令行启动屏幕会很有用,并且当用户关注应用程序流程时,它可能会用作反馈机制。
翻译自: https://davidwalsh.name/console-png
node.js 控制台