You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexec=require('child_process').execconstfs=require('fs')constexpress=require('express')constapp=express()// 创建文件示例app.post('/api/file/create',()=>{fs.writeFile('test.txt','hello world','utf8',err=>{app.send({err})})})// 执行 ng build --prod示例app.post('/api/cmd/bundle',()=>{exec('ng build --prod',{cwd: __dirname},(err,stdout,stderr)=>{// 将命令行执行结果返回到客户端app.send({err, stdout, stderr})})})app.listen(80,()=>{console.log('server start up at port 80')})
由于安全的限制,浏览器是不开放写文件的API的,即使提供也会有很多限制。
假如现在有这样一个需求,让你去实现一个类似vue-cli 3.0 的可视化脚手架工具。
现在有一个问题,浏览器是无法直接操作本地文件,在本地生成文件目录的,那么我如何实现这个功能呢?
The text was updated successfully, but these errors were encountered: