Sequential Execution and Iteration

Learn to implement sequential asynchronous operations with promises.

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 the promises object of the fs 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 1400+ tech skills courses.