Skip to main content

stream/consumers

The utility consumer functions provide common options for consuming streams.

Usage in Deno

import * as mod from "node:stream/consumers";

Functions

f
arrayBuffer
No documentation available
    f
    blob
    No documentation available
      f
      buffer
      No documentation available
        f
        json
        No documentation available
          f
          text
          No documentation available

            function arrayBuffer

            Usage in Deno

            import { arrayBuffer } from "node:stream/consumers";
            
            #arrayBuffer(stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>
            ): Promise<ArrayBuffer>

            Parameters #

            #stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>

            Return Type #

            Promise<ArrayBuffer>

            Fulfills with an ArrayBuffer containing the full contents of the stream.


            function blob

            Usage in Deno

            import { blob } from "node:stream/consumers";
            
            #blob(stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>
            ): Promise<NodeBlob>

            Parameters #

            #stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>

            Return Type #

            Promise<NodeBlob>

            Fulfills with a Blob containing the full contents of the stream.


            function buffer

            Usage in Deno

            import { buffer } from "node:stream/consumers";
            
            #buffer(stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>
            ): Promise<Buffer>

            Parameters #

            #stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>

            Return Type #

            Promise<Buffer>

            Fulfills with a Buffer containing the full contents of the stream.


            function json

            Usage in Deno

            import { json } from "node:stream/consumers";
            
            #json(stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>
            ): Promise<unknown>

            Parameters #

            #stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>

            Return Type #

            Promise<unknown>

            Fulfills with the contents of the stream parsed as a UTF-8 encoded string that is then passed through JSON.parse().


            function text

            Usage in Deno

            import { text } from "node:stream/consumers";
            
            #text(stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>
            ): Promise<string>

            Parameters #

            #stream:
            WebReadableStream
            | ReadableStream
            | AsyncIterable<any>

            Return Type #

            Promise<string>

            Fulfills with the contents of the stream parsed as a UTF-8 encoded string.


            Did you find what you needed?

            Privacy policy