如何设置/定义const文件?
尝试将路径和CSV文件位置放置在()中,但不返回值。
const searchkeywords = readKeyWords('./datain/testdata.csv','utf-8'); // database
function readKeyWords(path) {
return fs.readFileSync(path, 'utf-8')
.split('\n');
}
async function printFiles () {
const files = await getFilePaths();
for (const file of files) {
const contents = await fs.readFile(file, 'utf8');
console.log(contents);
}
}
希望实现顺序迭代,串行处理。