deno.land / x / msgpack_javascript@v3.0.0-beta2 / src / decodeAsync.ts

decodeAsync.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { Decoder } from "./Decoder";import { ensureAsyncIterable } from "./utils/stream";import type { DecoderOptions } from "./Decoder";import type { ReadableStreamLike } from "./utils/stream";import type { SplitUndefined } from "./context";
/** * @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty. * @throws {@link DecodeError} if the buffer contains invalid data. */ export async function decodeAsync<ContextType = undefined>( streamLike: ReadableStreamLike<ArrayLike<number> | BufferSource>, options?: DecoderOptions<SplitUndefined<ContextType>>,): Promise<unknown> { const stream = ensureAsyncIterable(streamLike); const decoder = new Decoder(options); return decoder.decodeAsync(stream);}
/** * @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty. * @throws {@link DecodeError} if the buffer contains invalid data. */ export function decodeArrayStream<ContextType>( streamLike: ReadableStreamLike<ArrayLike<number> | BufferSource>, options?: DecoderOptions<SplitUndefined<ContextType>>,): AsyncGenerator<unknown, void, unknown> { const stream = ensureAsyncIterable(streamLike); const decoder = new Decoder(options); return decoder.decodeArrayStream(stream);}
/** * @throws {@link RangeError} if the buffer is incomplete, including the case where the buffer is empty. * @throws {@link DecodeError} if the buffer contains invalid data. */export function decodeMultiStream<ContextType>( streamLike: ReadableStreamLike<ArrayLike<number> | BufferSource>, options?: DecoderOptions<SplitUndefined<ContextType>>,): AsyncGenerator<unknown, void, unknown> { const stream = ensureAsyncIterable(streamLike); const decoder = new Decoder(options); return decoder.decodeStream(stream);}
/** * @deprecated Use {@link decodeMultiStream()} instead. */export const decodeStream: never = undefined as never;
msgpack_javascript

Version Info

Tagged at
a year ago