import { MaybePromise } from '@fuman/utils';
import { Bytes } from '../bytes.js';
import { ISyncWritable } from '../types.js';
export interface IFrameDecoder {
/**
* Decode a frame from a buffer
*
* > **Important implementation notice**: When returning byte arrays, make sure that the returned array is **not**
* > a view into the original buffer, as the underlying buffer may get invalidated
*/
decode: (buf: Bytes, eof: boolean) => MaybePromise;
}
export interface IFrameEncoder {
/** Encode a frame into a writable stream */
encode: (frame: Frame, into: ISyncWritable) => MaybePromise;
/** Reset the encoder, should it have any internal state */
reset: () => void;
}