Node.js - Download .docx file exported as html from onedrive using microsoftgraph api call

381
May 19, 2017, at 8:08 PM

When making a call like this example from here

client
    .api('/me/drive/root/children/Doc.docx/content') 
    .getStream((err, downloadStream) => {
        let writeStream = fs.createWriteStream('Mydoc.docx');  
        downloadStream.pipe(writeStream).on('error', console.log);
    });

It works as expected. What I want is to get the .docx file as html. Is there any way to download it in html format? Or do I have to save the file and then try to export it to html. Thanks

Answer 1

Word Documents (.docx) do not use HTML, they use Office Open XML (OOXML). Technically they are a zipped package that contains several elements along with the raw OOXML of the document.

OneDrive itself does not provide any document conversion tools, it is just the cloud storage the document is stored in.

In order to convert a document from one format to another (OOXML to HTML for example), you'll need to use a 3rd party tool or service for that purpose. I'd suggest taking a look as Aspose. They offer a slew of file format conversion tools including one for Word. I've had a number of developers report good results using their Aspose Cloud services as well.

Rent Charter Buses Company
READ ALSO
How to get a count from MongoDB using Node.js? [on hold]

How to get a count from MongoDB using Node.js? [on hold]

I'd like to return the number of data which satisfies the query in MongoDB using Nodejs

327
Node directory parser [on hold]

Node directory parser [on hold]

I'm trying to make function which takes as an argument directory string (for example: 'public/css') parse that directory and subdirectories and returns an array of file paths relative to the project directory

295
angular2 client unable to handle large streamed response from server

angular2 client unable to handle large streamed response from server

I have an angular2 client HTTP request being thrown to a nodejs server which is fetching a huge collection(~ 2 Million documents) from MongoDB and sending it as streamed response to the client

375