Recently I'm working on a function which involve html template.
What this function does is to generate a dynamic template, and convert it into an image. As my understanding and what I R&D so far, it require to be a read stream before it able to convert into an image file.
So far, i manage to do it like this
fs.writeFile('sample.html', '<html>...</html>', function(err){
fs.createReadStream('sample.html')
.pipe(convert()) //function from html-convert npm package
.pipe(fs.createWriteStream('out.png'))
});
Is there anyway to do this other than create a new file just for converting it to image?
Any help to this will be appreciated. Thanks.