Sequential Execution and Iteration
Learn to implement sequential asynchronous operations with promises.
We'll cover the following
Sequential execution
Now that we’re familiar with web spider applications, we’ll create one that uses promises. Let’s start with the web spider example that downloads the links of a web page in sequence.
Note: We can access an already promisified version of the core
fs
API through thepromises
object of thefs
module. For example:import { promises } from 'fs'
.
In the spider.js
module, the very first step required is to import our dependencies and promisify any callback-based function that we’re going to use:
Get hands-on with 1200+ tech skills courses.