Skip to content
Browse files

ray example using toBuffer()

  • Loading branch information...
1 parent 002bcf0 commit 0312b1c97f9aa5303b60b7adb31dd6e2413260bd @tj tj committed
Showing with 4 additions and 6 deletions.
  1. +4 −6 examples/ray.js
View
10 examples/ray.js
@@ -79,9 +79,7 @@ ctx.translate(243,0);
render(1);
console.log('Rendered in %s seconds', (new Date - start) / 1000);
-var out = fs.createWriteStream(__dirname + '/ray.png')
- , stream = canvas.createPNGStream();
-
-stream.on('data', function(chunk){
- out.write(chunk);
-});
+canvas.toBuffer(function(err, buf){
+ if (err) throw err;
+ fs.writeFile(__dirname + '/ray.png', buf);
+});

0 comments on commit 0312b1c

Please sign in to comment.
Something went wrong with that request. Please try again.