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

1.0.2 • Public • Published

Installation

npm install --save @types/fastestsmallesttextencoderdecoder

Summary

This package contains type definitions for fastestsmallesttextencoderdecoder (https://github.com/anonyco/FastestSmallestTextEncoderDecoder#quick-start).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fastestsmallesttextencoderdecoder.

index.d.ts

export type Binary = ArrayBuffer | Uint8Array | DataView;
export interface DecodeOptions {
    stream?: boolean;
}

/**
 * https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode
 */
export function encode(text: string): Uint8Array;

/**
 * https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode
 */
export function decode(binary?: Binary, options?: DecodeOptions): string;

export class TextDecoder {
    /**
     * https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode
     */
    decode(binary?: Binary, options?: DecodeOptions): string;
}

export interface EncodingProgress {
    // The number of UTF-16 units of code from the source that has been converted over to UTF-8. This may be less than
    // text.length if Uint8Array did not have enough space.
    read: number;

    // The number of bytes modified in the destination Uint8Array. The bytes written are guaranteed to form complete
    // UTF-8 byte sequences.
    written: number;
}

export class TextEncoder {
    /**
     * https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode
     */
    encode(text: string): Uint8Array;

    /**
     * https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto
     */
    encodeInfo(text: string, array: Uint8Array): EncodingProgress;
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Loren 🤓.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/fastestsmallesttextencoderdecoder

Weekly Downloads

3,212

Version

1.0.2

License

MIT

Unpacked Size

5.37 kB

Total Files

5

Last publish

Collaborators

  • types