|
|
@ -14,6 +14,21 @@ var EventEmitter = require('events').EventEmitter; |
|
|
|
/** |
|
|
|
* Initialize a `PNGStream` with the given `canvas`. |
|
|
|
* |
|
|
|
* "data" events are emitted with `Buffer` chunks, once complete the |
|
|
|
* "end" event is emitted. The following example will stream to a file |
|
|
|
* named "./my.png". |
|
|
|
* |
|
|
|
* var out = fs.createWriteStream(__dirname + '/my.png') |
|
|
|
* , stream = canvas.createPNGStream(); |
|
|
|
* |
|
|
|
* stream.on('data', function(chunk){ |
|
|
|
* out.write(chunk); |
|
|
|
* }); |
|
|
|
* |
|
|
|
* stream.on('end', function(){ |
|
|
|
* out.end(); |
|
|
|
* }); |
|
|
|
* |
|
|
|
* @param {Canvas} canvas |
|
|
|
* @api public |
|
|
|
*/ |
|
|
|