With node-canvas (https://github.com/learnboost/node-canvas) we can save Canvas on disk.
How can we access Canvas element on client’s side from Node.js server?
- Client connects to Node.js server
- Server serves response. Client draws on Canvas
- Client clicks “save” and SERVER saves this Canvas to server’s disk.
Problem courtesy of: Pono
You can get the canvas data by calling
var data = canvas.toDataUrl(); This creates a data url that you could then send back to the server to save. Check out 4.8.11 The canvas element. There are a few different options you can pass along to the
toDataUrl function to vary the output.
Solution courtesy of: Prescott