sdf-parser
    Preparing search index...

    Function iterator

    • Asynchronously iterate over molecules from a text-decoded SDF stream.

      Parameters

      • readStream: ReadableStream<string>

        A ReadableStream<string> supplying SDF text content.

      • options: IteratorOptions = {}

        Iterator options.

      Returns AsyncGenerator<IteratorMolecule>

      Individual molecule objects.

      import { openAsBlob } from 'node:fs';
      import { iterator } from 'sdf-parser';

      const blob = await openAsBlob('compounds.sdf');
      const textDecoder = new TextDecoderStream();
      for await (const molecule of iterator(blob.stream().pipeThrough(textDecoder))) {
      console.log(molecule.molfile);
      }