Ducklings API Documentation
    Preparing search index...

    An async streaming query result.

    This class allows you to process large result sets in chunks, which is more memory-efficient than loading everything at once.

    Implements AsyncIterable for use with for await...of.

    const stream = await conn.queryStreaming('SELECT * FROM large_table');

    // Using for await...of
    for await (const chunk of stream) {
    console.log(`Processing ${chunk.rowCount} rows`);
    for (const row of chunk.toArray()) {
    processRow(row);
    }
    }

    // Or manually
    let chunk;
    while ((chunk = await stream.nextChunk()) !== null) {
    console.log(chunk.rowCount);
    }

    await stream.close();

    Implements

    Index

    Constructors

    Methods

    • Collect all remaining chunks into an array of objects.

      Warning: This loads all data into memory. Use nextChunk() or for await...of for large result sets.

      Type Parameters

      • T = Record<string, unknown>

      Returns Promise<T[]>

      Promise resolving to array of all result rows