我需要从URL请求一个.zip文件,然后将内容传递给AdmZip
当试图传输请求库的输出时:
const zipFilePath = path.join(batchPath, this.zipFile.filename);
const out = fs.createWriteStream(zipFilePath);
const req = request.get(this.zipFile.url);
req.pipe(out);
req.on('end', function() {
console.log("I should be here, but I'm not");
});我收到:
错误: ENOENT:没有这样的文件或目录,打开'C:\Users\Brandon\work\keystone4-projects\html-email\batch-content\5996588a3bc30010502bfa9e\test.zip‘
我做错了什么?
编辑:
我补充说:
if (!fs.existsSync(batchPath)) {
fs.mkdirSync(batchPath);
}在尝试成功完成输出和我的函数之前。
发布于 2017-08-18 03:26:41
通常,当您在写入文件时收到此错误时,它意味着指向正在写入的文件的路径不存在。
https://stackoverflow.com/questions/45747927
复制相似问题