How to Convert EML to PNG in Node.JS

Cloudmersive
1 min readJul 2, 2020

--

Converting EML files is a difficult process under the best of circumstances. The task is made more difficult still when working in Node.JS. Thankfully, there is an easier solution that I have in mind, one that will handle all of the parsing of HTML, rendering, etc. To do this, we have only but to set up a function call for an API. Let’s look at how this is set up.

First is our client installation.

npm install cloudmersive-convert-api-client --save

Now the function call:

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveConvertApiClient.ConvertDocumentApi();var inputFile = "/path/to/file"; // File | Input file to perform the operation on.var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.convertDocumentEmlToPng(inputFile, callback);

And finally… well that’s it, really. For more lightning-fast solutions like this, check out the documentation section for more on this library.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet