javascript - Node.js:使用 excel 获取 + 管道不起作用
问题描述
我正在尝试读取 excel 的内容并将其写入另一个 excel。但可能是我错过了一些东西。这是我的代码的相关部分
await fetch(fetchUrl)
.then(
res =>
new Promise((resolve, reject) => {
const dest = fs.createWriteStream("./text.xlsx");
res.body.pipe(dest);
res.body.on("end", () => resolve("it worked"));
dest.on("error", reject);
})
)
.then(x => console.log(x));
如果我尝试打开文件,我会收到以下警报
Excel cannot open the file ’text.xlsx’ because the file format or file extension is not valid. Verify
that the file has not been corrupted and that the file extension matches the format of the file.
关于我所缺少的任何帮助都会非常棒。谢谢。
解决方案
推荐阅读
- pdf - PDF下载而不是嵌入网页
- reactjs - Eslint - 限制从根目录导入并强制执行 tree-shaking
- mysql - 表名中的 MySQL 临时变量
- python - 字符串连接尝试导致意外错误
- http - Flutter:InternalError,过滤器错误,在服务器上上传图像时数据错误
- javascript - 如何在 React-Native 中创建 Intent 并将数据传递给它?
- django - 测试图像上传总是失败
- python - 将 DataFrame 与“不均匀”数据合并
- google-cloud-firestore - .json 文件中的 Cloud Firestore 敏感信息
- reactjs - 导出材质ui主题包