【发布时间】:2020-07-05 02:26:32
【问题描述】:
我在 React 中执行 fetch 方法,它返回同样命名的 .pdf 文件,现在我想获取该文件名。
function downloadPdf() {
fetch(BASE_URL + `/example/example/pdf/${exampleId}`)
.then(r => r.blob())
.then(showFile);
}
function showFile(blob, filename) {...}
如何获取文件名并使用文件名调用我的函数showFile?
【问题讨论】:
标签: reactjs api file fetch filenames