fs.createReadStream
is asynchronous with the event emitter style and does not throw exceptions (which only make sense for synchronous code). Instead it will emit an error event.
const fs = require('fs')
const stream = fs.createReadStream('foo');
stream.on('error', function (error) {console.log("Caught", error);});
stream.on('ready', function () {stream.read();});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…