@types/buffer-json-encoding
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/buffer-json-encoding

Summary

This package contains type definitions for buffer-json-encoding (https://github.com/lachenmayer/buffer-json-encoding).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/buffer-json-encoding.

index.d.ts

/// <reference types="node" />

/**
 * An [abstract-encoding](https://github.com/mafintosh/abstract-encoding) compatible JSON encoder
 * that properly encodes `Buffer`s.
 *
 * @param buffer The `Buffer` to encode.
 * @param [offset=0] The byte offset to encode `buffer` at in the newly allocated `Buffer`.
 */
export function encode(buffer: Buffer, offset?: number): Buffer;
/**
 * An [abstract-encoding](https://github.com/mafintosh/abstract-encoding) compatible JSON encoder
 * that properly encodes `Buffer`s.
 *
 * @param buffer The `Buffer` to encode.
 * @param target The `Buffer` to encode the `buffer` into.
 * @param [offset=0] The byte offset to encode `buffer` at in `target`.
 */
export function encode(buffer: Buffer, target: Buffer, offset?: number): Buffer;
export namespace encode {
    /**
     * The amount of bytes used to encode the `Buffer`. This property is set after each call to `encode()`.
     */
    const bytes: number | undefined;
}

/**
 * An [abstract-encoding](https://github.com/mafintosh/abstract-encoding) compatible JSON decoder
 * that properly decodes `Buffer`s.
 *
 * @param buffer The `Buffer` to decode a stringified `Buffer` from.
 * @param [start=0] The byte offset into `buffer` to start decoding the encoded `Buffer`.
 * @param [end=buffer.length] The byte offset into `buffer` to end decoding the encoded `Buffer`
 * (not including the byte at the end-offset).
 */
export function decode(buffer: Buffer, start?: number, end?: number): Buffer;
export namespace decode {
    /**
     * The amount of bytes used to decode the `Buffer`. This property is set after each call to `decode()`.
     */
    const bytes: number | undefined;
}

/**
 * @returns The amount of bytes needed to encode `buffer`.
 */
export function encodingLength(buffer: Buffer): number;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/node

Credits

These definitions were written by BendingBender.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/buffer-json-encoding

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

6.34 kB

Total Files

5

Last publish

Collaborators

  • types