How to use p-times - 1 common examples

To help you get started, we’ve selected a few p-times examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github popcorn-official / popcorn-api / src / scraper / providers / BaseProvider.js View on Github external
getAllTorrents(totalPages: number): Promise> {
    let torrents = []
    return pTimes(totalPages, async page => {
      this.query.page = page + 1

      logger.info(`${this.name}: Started searching ${this.name} on page ${page + 1} out of ${totalPages}`)
      const res = await this.api.search(this.query)
      const data = res.results
        ? res.results // Kat & ET
        : res.data
          ? res.data.movies // YTS
          : res.torrents
            ? res.torrents // Nyaa
            : []

      torrents = torrents.concat(data)
    }, {
      concurrency: 1
    }).then(() => {

p-times

Run promise-returning & async functions a specific number of times concurrently

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular p-times functions