prorm API Reference
    Preparing search index...

    Interface ModelStreamingOperations<T>

    Streaming operations available on every model.

    interface ModelStreamingOperations<T = any> {
        iterate(
            findOptions?: FindOptions,
            options?: StreamingOptions,
        ): AsyncGenerator<T>;
        stream(findOptions?: FindOptions, options?: StreamingOptions): Readable;
    }

    Type Parameters

    • T = any

    Hierarchy (View Summary)

    Index
    • Walk every matching row, one at a time, without loading them all.

      for await (const user of User.iterate({ where: { status: 'active' } })) {
      await ship(user);
      }

      Parameters

      Returns AsyncGenerator<T>

    • The same rows as a Node Readable in object mode, for pipeline() and the stream transforms.

      await pipeline(
      User.stream({ where: { status: 'active' } }),
      new BatchTransform({ batchSize: 500 }),
      async function* (batches) { for await (const b of batches) yield index(b); },
      );

      Parameters

      Returns Readable