1 import type RAL from './ral';
2 import { Message } from './messages';
3 export interface FunctionContentEncoder {
5 encode(input: Uint8Array): Promise<Uint8Array>;
7 export interface StreamContentEncoder {
9 create(): RAL.WritableStream;
11 export declare type ContentEncoder = FunctionContentEncoder | (FunctionContentEncoder & StreamContentEncoder);
12 export interface FunctionContentDecoder {
14 decode(buffer: Uint8Array): Promise<Uint8Array>;
16 export interface StreamContentDecoder {
18 create(): RAL.WritableStream;
20 export declare type ContentDecoder = FunctionContentDecoder | (FunctionContentDecoder & StreamContentDecoder);
21 export interface ContentTypeEncoderOptions {
22 charset: RAL.MessageBufferEncoding;
24 export interface FunctionContentTypeEncoder {
26 encode(msg: Message, options: ContentTypeEncoderOptions): Promise<Uint8Array>;
28 export interface StreamContentTypeEncoder {
30 create(options: ContentTypeEncoderOptions): RAL.WritableStream;
32 export declare type ContentTypeEncoder = FunctionContentTypeEncoder | (FunctionContentTypeEncoder & StreamContentTypeEncoder);
33 export interface ContentTypeDecoderOptions {
34 charset: RAL.MessageBufferEncoding;
36 export interface FunctionContentTypeDecoder {
38 decode(buffer: Uint8Array, options: ContentTypeDecoderOptions): Promise<Message>;
40 export interface StreamContentTypeDecoder {
42 create(options: ContentTypeDecoderOptions): RAL.WritableStream;
44 export declare type ContentTypeDecoder = FunctionContentTypeDecoder | (FunctionContentTypeDecoder & StreamContentTypeDecoder);
48 export declare namespace Encodings {
49 function getEncodingHeaderValue(encodings: Named[]): string | undefined;
50 function parseEncodingHeaderValue(value: string): string[];