Free Support Forum - aspose.cloud

Download file from cloud storage to local drive in Node.js with Aspose.Words Cloud API

Not through the dashboard ui or by using storage api download. I want to download the file to my local storage by triggering nodejs api.

heres my code to download from the aspose cloud

storageApi.GetDownload(tempResponse, versionId=null, storage=null, function(responseMessage) {
console.log(‘status:’, responseMessage.status);
console.log(‘body:’, responseMessage.body);
console.log(responseMessage.body);
});
Output I m getting is a buffer stream and not downloading the particular file to my pc or local storage.

@yogibittint

Thanks for your inquiry. You need to write stream data to a file on the local drive. Please check sample code snippet, hopefully it will help you to accomplish the task.

Please note in new Aspose.Words Cloud SDK for Node.js, we will include new methods of Aspose.Words Cloud for storage operations. You will no need to use Aspose.Storage Cloud API anymore.

var fileName = "MyPresentation.pptx";
var outputFile = "C:/Temp/MyPresentation_test.pptx";
storageApi.GetDownload(fileName, versionId=null, storage=null, function(responseMessage) {
	fs.writeFileSync(outputFile, responseMessage.body);
console.log("File saved:", outputFile);
                     console.log("File Downloaded");    
                    });
1 Like

thanks a lot :slight_smile:

1 Like