@triply/triplydb
    Preparing search index...

    Class QueryResultIterator<ResultType, Output>

    The results of a saved query: a ResultIterator that can also be written straight to a file.

    Returned by Query.results — specifically by its bindings() and statements() methods. Never constructed directly. Only query results support QueryResultIterator.toFile; the collections returned elsewhere in this library are plain ResultIterators.

    Type Parameters

    • ResultType
    • Output

    Hierarchy (View Summary)

    Index
    • Fetches every remaining page and returns all results as an array.

      Returns Promise<Output[]>

      Consumes the whole collection, so prefer iterating when you only need part of it.

      const datasets = await account.getDatasets().toArray()
      
    • Writes every result to a file, a page at a time.

      Parameters

      • filePath: string

        where to write. Any existing file is overwritten.

      • Optionalopts: { compressed?: boolean }

        set compressed to gzip the output as it is written.

      Returns Promise<void>

      The format is decided by which accessor produced this iterator, not by the file name you pass: bindings() writes TSV, and statements() writes N-Triples. Pick an extension that matches, because nothing here will correct it for you. Consumes the whole result set.

      const results = query.results().statements()
      await results.toFile('results.nt.gz', { compressed: true })