Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created September 4, 2014 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/1fa2efa9c93f57ad234b to your computer and use it in GitHub Desktop.
Save tmcw/1fa2efa9c93f57ad234b to your computer and use it in GitHub Desktop.
var out = fs.createWriteStream(__dirname + '/' + filename + ".png")
, stream = canvas.createPNGStream();
stream.on('data', function(chunk){
out.write(chunk);
});
// can be
canvas.createPNGStream()
.pipe(fs.createWriteStream(__dirname + '/' + filename + ".png"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment