github:https://github.com/shelljs/shelljs
使用起来比较简单
//example
const shell = require('shelljs')
shell.mkdir('./test')
shell.cd('./test')
shell.touch('hello.js')
shell.exec( "echo console.log('hello world') >> hello.js")
shell.exec('node ../test/hello.js')
//output:hello world
这个博客展示了如何利用Node.js模块ShellJS进行基本的文件系统操作,如创建目录、切换工作目录、创建文件、追加内容到文件及执行Node.js脚本。通过简单易懂的示例代码,演示了ShellJS的实用功能。
721

被折叠的 条评论
为什么被折叠?



