Skip to content

Instantly share code, notes, and snippets.

@shizuka-na-kazushi
Last active September 20, 2020 00:14
Show Gist options
  • Save shizuka-na-kazushi/50b46c438a47d06f9323e48fd3755d90 to your computer and use it in GitHub Desktop.
Save shizuka-na-kazushi/50b46c438a47d06f9323e48fd3755d90 to your computer and use it in GitHub Desktop.
fsのcreateReadStreamを使って「何か」をする関数を呼び出す
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