=> { let data = '' stream.on('data', (chunk) => { data += chunk }) stream.once('end', () => { return resolve(data) }) stream.once(‘error', (err) => { return reject(err) }) }) const data = await recv() const drain = (stream) => { return new Promise((resolve, reject) => { stream.once('data', (data) => { stream.pause() … resolve(data) }) stream.once('end', () => { … resolve(null) }) stream.once('error', (err) => { … reject(err) }) stream.resume() }) } const main = async () => { const stream = fs.createReadStream(‘file’) let data = null while (data = await drain(stream)) { console.log(data) } } 1SPNJTFͰแΈࠐΉ ϫϯγϣοτม ෳࡶղͳ ΠςϨʔγϣϯରԠ