Put on your asynchronous hat and node
summary
Node.js runs JavaScript on a single thread and gets massive concurrency by offloading slow IO to the OS — IO can be ~100,000× slower than CPU work — so filesystem and HTTP calls are always asynchronous. Examples show fs.readdir vs readdirSync, then a serial Pyramid of Doom from nested callbacks and tedious error checking, and two fixes: control-flow libs like async.js (series/parallel/map) and Q promises with chaining and q.all for parallel results and exception-style error bubbling.
AI-written summary · about
chapters (21)
- 0:00Intro
- 0:16Put On Your Asynchronous Hat and Node
- 1:01What is an Asynchronous Hat?
- 3:57Different Mindsets
- 8:10Asynchronous Code
- 10:12Asynchronous Parallel Execution
- 13:36Event Mechanisms
- 14:21Single Callback Functions
- 18:47World With Exceptions
- 19:38World Before Exceptions
- 22:33Callback Error Handling
- 23:17Event Emitter Error Handling
- 23:37Pyramid of Doom With Error Handling
- 24:00Asynchronous Error Handling
- 25:29Nesting Named Callbacks
- 26:01Control Flow libraries
- 27:55Series
- 30:28Functional Constructs
- 32:10Promises
- 36:11Promise Chaining
- 37:58Promise Error Handling
related talks
22mDon’t Try This at Home: Synchronous I/O in Node.js
39mYou Don’t Node.js
13mConcurrency vs Parallelism in Node.js: Understanding the Event Loop & Worker Threads
34mYou Don't Know Node.js
53mMastering Node.js Performance
22mScaling Node.js and unblocking the Event Loop
28mBryan Hughes - SeattleJS Conference 2017
53mMastering Node.js Performance
