Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

renderStream is not working for me. #231

Open
gourav1gourav opened this issue Mar 28, 2018 · 3 comments
Open

renderStream is not working for me. #231

gourav1gourav opened this issue Mar 28, 2018 · 3 comments

Comments

@gourav1gourav
Copy link

I need to convert the html to image but in base64 format. Currently i am only able to convert to image.
I am getting the image in the local folder when ever i am calling this api in front end. But i dont need to store in local folder i need the base64 string for the html encoded.

app.post('/api/screencapture', function (req, res) {
ImgId = Math.floor(Date.now() / 1000);
imgName = ImgId + '_capture.png'
imgUrl = __dirname + '/public/' + imgName;

imgPath = {};
imgPath.imgpath = imgName;

webshot(req.body.html, imgUrl, options, (err) => {

});

});

Please help me i tried a lot and stuck there.

thanks in advance

@drexdelta1
Copy link

me too :( .

@brittneykernan
Copy link

You need to remove the imgUrl from arguments.

let body = "data:" + "image/png" + ";base64,";
const renderStream = webshot(camUrl, options).on('data', function(data) {
body += data.toString('base64');
}).on('end', () => {
console.log(body);
console.log(Screenshot taken!);
});

@gourav1gourav
Copy link
Author

gourav1gourav commented Feb 13, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants