1
我想下載一組圖像文件,我從Parse中檢索並將它們保存到使用JSZip的zip文件中。從this link看來,我應該能夠通過在我的圖像對象上調用.base64來獲得base64編碼。我也試過toString('base64')。我的zip文件使用正確名稱的文件生成,但文件的內容爲空。我在這裏錯過了什麼嗎?將解析圖像文件轉換爲base64以保存在zip文件中
Parse.Cloud.httpRequest({ url: result.get('image').url() }).then(function(response) {
var image = new Image();
image.setData(response.buffer);
var base64Image = image.data().base64;
zip.folder('images').file(imageName, base64Image, {base64: true});
return Parse.Promise.as('Success')
})