Created
January 27, 2014 14:40
-
-
Save hadashiA/8649686 to your computer and use it in GitHub Desktop.
一本のReadableStreamを、二本のReadableStreamにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs = require 'fs' | |
gm = require 'gm' | |
im = gm.subClass imageMagick: true | |
{PassThrough} = require 'stream' | |
stream = fs.createReadStream '/Users/hadashi/tmp/20.png' | |
stream2 = new PassThrough | |
stream3 = new PassThrough | |
stream.on 'data', (data) -> | |
stream2.write data | |
stream3.write data | |
stream.on 'end', -> | |
stream2.end() | |
stream3.end() | |
im(stream2) | |
.size (err, size) -> | |
console.log arguments | |
im(stream3) | |
.size (err, size) -> | |
console.log arguments |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment