Function itr8FromStream

  • Transforms a readable stream into an async itr8.

    Each chunk of data wil be passed as a string if a default encoding has been specified for the stream using the readable.setEncoding() method; otherwise the data will be passed as a Buffer!

    Example

    // each next() call will return a Buffer
    itr8FromStream(fs.createReadStream("./myfile.bin"));
    // if you have a txt file you want to process line by line:
    const readableStream = fs.createReadStream("/home/me/mytextfile.txt", 'utf8');
    pipe(readableStream, lineByLine());

    Did you know that all readable streams are Iterables?

    Parameters

    • stream: Readable

    Returns AsyncIterableIterator<any>

Generated using TypeDoc