📜  如何使用 javascript 代码示例逐行写入和读取文本文件

📅  最后修改于: 2022-03-11 15:02:01.111000             🧑  作者: Mango

代码示例1
// For react you have fist to import the file you want to read from 

import file from './output.txt';

export function readTextFile(){
    fetch(file)
        .then(response => (response.text()))
        .then(data => {
            // Do something with your data
            console.log(data)
        });
}