Function streamToString

  • Drain a Readable into a string.

    Parameters

    • stream: Readable

      a Readable of string chunks

    Returns Promise<string>

    A promise that resolves to a string.

    Remarks

    This function is asynchronous and returns a promise that resolves to a string. If an error occurs during the conversion, it returns an empty string.

    Example

    require('fs').createReadStream('file.txt');;
    //=> {stream}
    await streamToString(fs.createReadStream('file.txt'));;
    //=> {content of 'file.txt'}

Generated using TypeDoc