const fs = require('fs');const readline = require('readline');const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.question('请输入文件所在路径:', (path) => { let file_path = path; rl.question('请输入新的文件名:', (name) => { let file_name = name; console.log(file_path); console.log(file_name); rl.close(); }); });
有没有办法直接定义全局变量,然后用 readline 读入变量?
婷婷同学_
相关分类