Created
June 15, 2020 08:57
-
-
Save parweb/1a2c2a29e8560caed30a3d176f94af63 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const emlformat = require('eml-format'); | |
const htmlToImage = require('html-to-image'); | |
const nodeHtmlToImage = require('node-html-to-image'); | |
const input = 'sample.eml'; | |
const output = 'image.png'; | |
const eml = fs.readFileSync(input, 'utf-8'); | |
emlformat.read(eml, function (error, data) { | |
if (error) return console.log(error); | |
nodeHtmlToImage({ | |
output, | |
html: data.html | |
}).then(() => console.log('The image was created successfully!')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment