it-length-prefixed
Advanced tools
Comparing version 10.0.0 to 10.0.1
import { Uint8ArrayList } from 'uint8arraylist'; | ||
import type { LengthDecoderFunction } from './index.js'; | ||
import type { DecoderOptions } from './index.js'; | ||
import type { Reader } from 'it-reader'; | ||
import type { Source } from 'it-stream-types'; | ||
export interface ReadState { | ||
dataLength: number; | ||
} | ||
export interface DecoderOptions { | ||
lengthDecoder?: LengthDecoderFunction; | ||
onData?(data: Uint8ArrayList): void; | ||
onLength?(length: number): void; | ||
maxLengthLength?: number; | ||
maxDataLength?: number; | ||
} | ||
export interface ReadResult { | ||
mode: string; | ||
chunk?: Uint8ArrayList; | ||
buffer: Uint8ArrayList; | ||
state?: ReadState; | ||
data?: Uint8ArrayList; | ||
} | ||
export declare function decode(source: Iterable<Uint8ArrayList | Uint8Array>, options?: DecoderOptions): Generator<Uint8ArrayList, void, unknown>; | ||
@@ -23,0 +6,0 @@ export declare function decode(source: Source<Uint8ArrayList | Uint8Array>, options?: DecoderOptions): AsyncGenerator<Uint8ArrayList, void, unknown>; |
import { Uint8ArrayList } from 'uint8arraylist'; | ||
import type { LengthEncoderFunction } from './index.js'; | ||
import type { EncoderOptions } from './index.js'; | ||
import type { Source } from 'it-stream-types'; | ||
interface EncoderOptions { | ||
lengthEncoder?: LengthEncoderFunction; | ||
maxDataLength?: number; | ||
} | ||
export declare function encode(source: Iterable<Uint8ArrayList | Uint8Array>, options?: EncoderOptions): Generator<Uint8Array, void, undefined>; | ||
@@ -13,3 +9,2 @@ export declare function encode(source: Source<Uint8ArrayList | Uint8Array>, options?: EncoderOptions): AsyncGenerator<Uint8Array, void, undefined>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=encode.d.ts.map |
@@ -48,2 +48,9 @@ /** | ||
export { decode } from './decode.js'; | ||
export interface DecoderOptions { | ||
lengthDecoder?: LengthDecoderFunction; | ||
onData?(data: Uint8ArrayList): void; | ||
onLength?(length: number): void; | ||
maxLengthLength?: number; | ||
maxDataLength?: number; | ||
} | ||
export interface LengthDecoderFunction { | ||
@@ -53,2 +60,6 @@ (data: Uint8ArrayList): number; | ||
} | ||
export interface EncoderOptions { | ||
lengthEncoder?: LengthEncoderFunction; | ||
maxDataLength?: number; | ||
} | ||
export interface LengthEncoderFunction { | ||
@@ -55,0 +66,0 @@ (value: number): Uint8ArrayList | Uint8Array; |
{ | ||
"DecoderOptions": "https://alanshaw.github.io/it-length-prefixed/interfaces/decode.DecoderOptions.html", | ||
"./decode:DecoderOptions": "https://alanshaw.github.io/it-length-prefixed/interfaces/decode.DecoderOptions.html", | ||
"ReadResult": "https://alanshaw.github.io/it-length-prefixed/interfaces/decode.ReadResult.html", | ||
"./decode:ReadResult": "https://alanshaw.github.io/it-length-prefixed/interfaces/decode.ReadResult.html", | ||
"ReadState": "https://alanshaw.github.io/it-length-prefixed/interfaces/decode.ReadState.html", | ||
"./decode:ReadState": "https://alanshaw.github.io/it-length-prefixed/interfaces/decode.ReadState.html", | ||
"decode": "https://alanshaw.github.io/it-length-prefixed/functions/decode.decode.html", | ||
@@ -12,2 +6,6 @@ "./decode:decode": "https://alanshaw.github.io/it-length-prefixed/functions/decode.decode.html", | ||
"./encode:encode": "https://alanshaw.github.io/it-length-prefixed/functions/encode.encode.html", | ||
"DecoderOptions": "https://alanshaw.github.io/it-length-prefixed/interfaces/index.DecoderOptions.html", | ||
".:DecoderOptions": "https://alanshaw.github.io/it-length-prefixed/interfaces/index.DecoderOptions.html", | ||
"EncoderOptions": "https://alanshaw.github.io/it-length-prefixed/interfaces/index.EncoderOptions.html", | ||
".:EncoderOptions": "https://alanshaw.github.io/it-length-prefixed/interfaces/index.EncoderOptions.html", | ||
"LengthDecoderFunction": "https://alanshaw.github.io/it-length-prefixed/interfaces/index.LengthDecoderFunction.html", | ||
@@ -14,0 +12,0 @@ ".:LengthDecoderFunction": "https://alanshaw.github.io/it-length-prefixed/interfaces/index.LengthDecoderFunction.html", |
{ | ||
"name": "it-length-prefixed", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"description": "Streaming length prefixed buffers with async iterables", | ||
@@ -5,0 +5,0 @@ "author": "Alan Shaw", |
@@ -8,26 +8,6 @@ /* eslint max-depth: ["error", 6] */ | ||
import { isAsyncIterable } from './utils.js' | ||
import type { LengthDecoderFunction } from './index.js' | ||
import type { DecoderOptions, LengthDecoderFunction } from './index.js' | ||
import type { Reader } from 'it-reader' | ||
import type { Source } from 'it-stream-types' | ||
export interface ReadState { | ||
dataLength: number | ||
} | ||
export interface DecoderOptions { | ||
lengthDecoder?: LengthDecoderFunction | ||
onData?(data: Uint8ArrayList): void | ||
onLength?(length: number): void | ||
maxLengthLength?: number | ||
maxDataLength?: number | ||
} | ||
export interface ReadResult { | ||
mode: string | ||
chunk?: Uint8ArrayList | ||
buffer: Uint8ArrayList | ||
state?: ReadState | ||
data?: Uint8ArrayList | ||
} | ||
enum ReadMode { | ||
@@ -34,0 +14,0 @@ LENGTH, |
@@ -7,10 +7,5 @@ import * as varint from 'uint8-varint' | ||
import { isAsyncIterable } from './utils.js' | ||
import type { LengthEncoderFunction } from './index.js' | ||
import type { EncoderOptions, LengthEncoderFunction } from './index.js' | ||
import type { Source } from 'it-stream-types' | ||
interface EncoderOptions { | ||
lengthEncoder?: LengthEncoderFunction | ||
maxDataLength?: number | ||
} | ||
// Helper function to validate the chunk size against maxDataLength | ||
@@ -17,0 +12,0 @@ function validateMaxDataLength (chunk: Uint8Array | Uint8ArrayList, maxDataLength: number): void { |
@@ -51,2 +51,10 @@ /** | ||
export interface DecoderOptions { | ||
lengthDecoder?: LengthDecoderFunction | ||
onData?(data: Uint8ArrayList): void | ||
onLength?(length: number): void | ||
maxLengthLength?: number | ||
maxDataLength?: number | ||
} | ||
export interface LengthDecoderFunction { | ||
@@ -57,2 +65,7 @@ (data: Uint8ArrayList): number | ||
export interface EncoderOptions { | ||
lengthEncoder?: LengthEncoderFunction | ||
maxDataLength?: number | ||
} | ||
export interface LengthEncoderFunction { | ||
@@ -59,0 +72,0 @@ (value: number): Uint8ArrayList | Uint8Array |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
52343
736