json-fs-query
    Preparing search index...

    Function retrieveFiles

    • Read several files of the database at once and resolve to their contents in the order of paths. Up to readConcurrency reads (see configure) are in flight together: in a browser each file is an HTTP request, so a full read of 1,000 rows no longer waits for 1,000 requests one after another.

      Fails as reading them one at a time would: with the error of the first file (in paths order) that can't be read. Once a read fails no new ones start; the ones already started are awaited, so none is left running after this returns, and since reads start in order, every file before the first failure was read.

      Parameters

      • paths: string[]

        Paths inside the database, such as users/1.json.

      • read: (path: string) => Promise<any> = retrieveFile

        Reads one path (default retrieveFile); callers with their own error message for a missing file pass it here.

      Returns Promise<any[]>

      The error of the first file that couldn't be read.