Yes I did it in Nodejs but I can't in PhantomJS.
imgContent = '...base64...string';
imgContent = imgContent.replace(/^data:image\/png;base64,/, "");
chart_path = "/charts.png";
fs.write(chart_path, new Buffer(imgContent, 'base64'), 'w');
The error message:
ReferenceError: Can't find variable: Buffer
I'm not sure is it best solution, but it works fine for me.
// ...
fs.write(chart_path, atob(imgContent), 'b');
Phantomjs version 2.1.1.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.