Last active
September 20, 2020 00:14
-
-
Save shizuka-na-kazushi/50b46c438a47d06f9323e48fd3755d90 to your computer and use it in GitHub Desktop.
fsのcreateReadStreamを使って「何か」をする関数を呼び出す
This file contains 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
var fs = require('fs'); | |
var doSomethingWithTheStream = require('./dosomething'); | |
// readable streamはcreateReadStream関数がインスタンス化する | |
var readable = fs.createReadStream('image.jpg'); | |
// 「何か」をする関数にオブジェクトを渡す | |
doSomethingWithTheStream(readable).then(() => { | |
console.log('All done!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment