There are multiple APIs available, each with their own advantages and disadvantages. Under the hood, they are all based on the same implementation.

  • Stream API
    The stream API might not be the most pleasant API to use but is scalable. It is the one upon which all the other implementation are based.
  • Callback API
    The callback API buffers all the emitted data from the stream API into a single object which is passed to a user provided function. Passing a function is easier than implementing the stream events function but it implies that the all dataset must fit into the available memory and it will only be available after the last record has been processed.
  • Stream + callback API
    Replace the writable stream with a string or buffer and the readable stream with a callback function.
  • Sync API
    The sync API provides simplicity, readability and convenience. Like for the callback API, it is meant for small dataset which fit in memory and which usage tolerates waiting for the last record.
  • Async iterator API
    The Async iterator API is both scalable and elegant. It takes advantage of the native Readable Stream API upon which the parser is build to iterate over the parsed records.

For additional usages and examples, you may refer to: