MCPcopy Create free account
hub / github.com/denoland/std / from

Method from

cbor/map_encoder_stream.ts:103–111  ·  view source on GitHub ↗

* Creates a CborMapEncoderStream instance from an iterable of * CborMapStreamInput chunks. * * @example Usage * ```ts * import { assert, assertEquals } from "@std/assert"; * import { * CborMapDecodedStream, * CborMapEncoderStream, * CborSequenceDecode

(
    asyncIterable:
      | AsyncIterable<CborMapStreamInput>
      | Iterable<CborMapStreamInput>,
  )

Source from the content-addressed store, hash-verified

101 * @returns A {@link CborMapEncoderStream} instance of the encoded data.
102 */
103 static from(
104 asyncIterable:
105 | AsyncIterable<CborMapStreamInput>
106 | Iterable<CborMapStreamInput>,
107 ): CborMapEncoderStream {
108 const encoder = new CborMapEncoderStream();
109 ReadableStream.from(asyncIterable).pipeTo(encoder.writable);
110 return encoder;
111 }
112
113 /**
114 * The {@link ReadableStream<Uint8Array>} associated with the instance, which

Calls

no outgoing calls

Tested by

no test coverage detected