diff --git a/lib/jpegstream.js b/lib/jpegstream.js index 6c8157d..3e7ec93 100644 --- a/lib/jpegstream.js +++ b/lib/jpegstream.js @@ -21,13 +21,7 @@ var Stream = require('stream').Stream; * var out = fs.createWriteStream(__dirname + '/my.jpeg') * , stream = canvas.createJPEGStream(); * - * stream.on('data', function(chunk){ - * out.write(chunk); - * }); - * - * stream.on('end', function(){ - * out.end(); - * }); + * stream.pipe(out); * * @param {Canvas} canvas * @param {Boolean} sync diff --git a/lib/pngstream.js b/lib/pngstream.js index cb5461d..38e08cd 100644 --- a/lib/pngstream.js +++ b/lib/pngstream.js @@ -21,13 +21,7 @@ var Stream = require('stream').Stream; * var out = fs.createWriteStream(__dirname + '/my.png') * , stream = canvas.createPNGStream(); * - * stream.on('data', function(chunk){ - * out.write(chunk); - * }); - * - * stream.on('end', function(){ - * out.end(); - * }); + * stream.pipe(out); * * @param {Canvas} canvas * @param {Boolean} sync