Free Support Forum -

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);
Output I m getting is a buffer stream and not downloading the particular file to my pc or local storage.


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


Please note, since Aspose.Words Cloue 19.4, we have provided storage API methods in the API. Please check documentation for details to work with files and folders using Aspose.Words Cloud.

const { WordsApi, DownloadFileRequest } = require("asposewordscloud");
var fs = require('fs');

// Get App SID and App Key from
wordsApi = new WordsApi("xxxxx-xxxx-xxxx-xxxx-xxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxx");
//Download File

var remoteFileName = "02_pages.docx";
var remoteDataFolder="Temp";
var outputFile = "C:/Temp/02_pages.docx";
const request = new DownloadFileRequest({
                    path: remoteDataFolder + "/" + remoteFileName

wordsApi.downloadFile(request).then((result) => {    
	fs.writeFileSync(outputFile, result.body);
//console.log("File saved:", outputFile);
    console.log("File Downloaded");    
}).catch(function(err) {
    // Deal with an error