Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including p-series with all npm packages installed. Try it out:

var pSeries = require("p-series")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

p-series v2.1.0

Run promise-returning & async functions in series

p-series Build Status

Run promise-returning & async functions in series

If you're doing the same work in each function, use p-each-series instead.

See p-all for a concurrent counterpart.


$ npm install p-series


const pSeries = require('p-series');
const got = require('got');

(async () => {
    const tasks = [
        () => got(''),
        () => checkSomething(),
        () => doSomethingElse()

    console.log(await pSeries(tasks));



Returns a Promise that is fulfilled when all promises returned from calling the functions in tasks are fulfilled, or rejects if any of the promises reject. The fulfilled value is an Array of the fulfilled values.


Type: Iterable<Function>

Functions are expected to return a value. If a Promise is returned, it's awaited before continuing with the next task.


  • p-all - Run promise-returning & async functions concurrently with optional limited concurrency
  • p-waterfall - Run promise-returning & async functions in series, each passing its result to the next
  • p-each-series - Iterate over promises serially
  • More…


MIT © Sindre Sorhus


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free