Step 3 / Select topic Node.js Easy

What this bank covers

  • process.nextTick runs before timers
  • Microtasks run before timer callbacks
  • setTimeout returns a Timeout object in Node
  • clearTimeout cancels a pending timer
  • setInterval repeats until cleared
  • Extra setTimeout arguments are passed to the callback
  • nextTick queue beats the check phase
  • A 0 ms timer still waits for the call stack to clear
  • Timers fire in order of expiry, not registration
  • process.nextTick vs setImmediate ordering
  • Buffer.byteLength vs String.length
  • Converting a Buffer to a hex string
  • Base64 encoding a Buffer
  • Indexing a Buffer yields a byte number
  • latin1 encoding uses one byte per character
  • Buffer.concat with an explicit totalLength
  • Resolving a relative URL against a base
  • URLSearchParams.get with repeated keys
  • URL host vs hostname
  • Error cause option
  • unhandledRejection hook
  • try/catch does not wrap async callbacks
  • Rejections skip then handlers
  • Environment values are strings
  • Reading an unset environment variable
  • Strict comparison against an env value
  • process.pid
  • process.version format
  • Assigning undefined to process.env
  • Deleting a process.env key
  • process.argv contents
  • Promise.all keeps input order
  • Promise.race settles with the first result
  • allSettled reports every outcome
  • try/catch around await
  • Microtasks drain before the check phase
  • catch returning a value resumes the chain
  • await always yields to a microtask
  • once() listeners fire a single time
  • The return value of emit()
  • listenerCount counts one event name
  • Listeners run in registration order
  • prependListener puts a listener first
  • removeListener needs the same function reference
  • emit() calls listeners synchronously
  • The default max listeners limit
  • events.once() resolves with the emit arguments
  • removeAllListeners with an event name
  • Async iteration over a readable stream
  • Return value of readable.pipe()
  • Counting calls to a writable's _write
  • Transform streams rewrite every chunk
  • pipe() does not forward errors
  • PassThrough forwards bytes unchanged
  • Object mode preserves JavaScript values
  • pipeline rejects on a stream error
  • setEncoding on a readable stream
  • PassThrough collects every written chunk
  • buf.write returns bytes actually written
  • subarray shares memory with the original buffer
  • appendFileSync adds to the end of a file
  • readFileSync without an encoding returns a Buffer
  • stat().size reports the byte length of the file
  • fs/promises readFile with an encoding resolves to a string
  • mkdirSync with recursive: true is idempotent
  • readdirSync returns names, not paths
  • renameSync moves a file rather than copying it
  • Missing files give an ENOENT error to the callback
  • Stats.isFile() and Stats.isDirectory()
  • appendFileSync creates the file when needed
  • path.join normalizes segments
  • path.extname takes only the last dot
  • path.basename with a suffix argument
  • path.resolve restarts at absolute segments
  • require returns the cached exports object
  • Reassigning exports does not change the export
  • exports starts as an alias of module.exports
  • A module body runs only once
  • Assigning module.exports replaces earlier properties
  • require parses .json files
  • __filename inside a required module
  • Circular require returns partial exports
  • module.exports can be any value
  • The cache is keyed by resolved filename
  • AggregateError from Promise.any
  • System error codes in fs callbacks
  • try/catch does not cover async callbacks
  • name on Error subclasses
  • Unhandled 'error' events throw synchronously
  • events.once resolves with an array of emitted arguments
  • timers/promises setTimeout resolves with its value argument
  • process.env key case sensitivity
  • process.nextTick extra arguments