diff --git a/docs/api/js-utils.encode.md b/docs/api/js-utils.encode.md index 665416e..129790c 100644 --- a/docs/api/js-utils.encode.md +++ b/docs/api/js-utils.encode.md @@ -9,7 +9,7 @@ Concatenate then encode a list of buffers. Signature: ```typescript -export declare function encode(chunks: Array, encoding: string): string; +export declare function encode(chunks: Array, encoding: AllowedBufferEncoding): string; ``` ## Parameters @@ -17,7 +17,7 @@ export declare function encode(chunks: Array, encoding: string): string; | Parameter | Type | Description | | --- | --- | --- | | chunks | Array<Buffer> | | -| encoding | string | | +| encoding | AllowedBufferEncoding | | Returns: diff --git a/src/Buffer.ts b/src/Buffer.ts index f336504..8bc0f8c 100644 --- a/src/Buffer.ts +++ b/src/Buffer.ts @@ -1,3 +1,5 @@ +export type AllowedBufferEncoding = 'ascii' | 'utf-8'; + /** * Concatenate a list of buffers. * @@ -13,7 +15,7 @@ export function concat(chunks: Array): Buffer { * * @public */ -export function encode(chunks: Array, encoding: string): string { +export function encode(chunks: Array, encoding: AllowedBufferEncoding): string { if (chunks.length === 0) { return ''; }