Skip to main content

@std/streams@0.215.0

latest
Works with
It is unknown whether this package works with Node.js, Deno, Browsers, Cloudflare Workers, Bun
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function toJson
toJson(readableStream: ReadableStream): Promise<unknown>

Converts a JSON-formatted ReadableSteam of strings or Uint8Arrays to an object. Works the same as Response.json.

Examples

Example 1

import { toJson } from "@std/streams/to_json";

const stream = ReadableStream.from([JSON.stringify({ hello: "world" })]);
await toJson(stream); // { hello: "world" }

Parameters

readableStream: ReadableStream

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/streams

Import symbol

import { toJson } from "@std/streams";
or

Import directly with a jsr specifier

import { toJson } from "jsr:@std/streams";