Is there a way to return the result from the PhantomJS web server as binary?
To be more specific, if I create a screenshot of the page as base64, can I convert this base64 string to a binary file and return it so that the client accepts it as an image?
This is what I have so far; I have commented on some of my experiments, which apparently do not work.
response.statusCode = 200; response.setHeader("Content-Type", "image/png"); //response.setHeader("Content-Encoding","base64"); var base64 = page.renderBase64('png'); //var binary=atob(base64,"b"); response.write(base64 ); response.close();
Ideas?
source share