如果我想下載一個文件,我應該怎麼做在then
塊以下?如何使用window.fetch下載文件?
function downloadFile(token, fileId) {
let url = `https://www.googleapis.com/drive/v2/files/${fileId}?alt=media`;
return fetch(url, {
method: 'GET',
headers: {
'Authorization': token
}
}).then(...);
}
注意代碼在客戶端。
增加一個屬性下載到具有URL的鏈接'https://www.googleapis.com/drive/v2/files/$ {}寫到FileID?ALT = media' – Arjun