我将如何设置/定义const文件?

时间:2019-06-06 20:21:51

标签: javascript async-await

如何设置/定义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);
            }
        }

希望实现顺序迭代,串行处理。

0 个答案:

没有答案