npm.io
0.1.2 • Published 2 years ago

@types/jconv

Licence
MIT
Version
0.1.2
Deps
1
Size
4 kB
Vulns
0
Weekly
0
Stars
51.4K

Installation

npm install --save @types/jconv

Summary

This package contains type definitions for jconv (https://github.com/narirou/jconv).

Details

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

index.d.ts

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

declare function jconv(buf: Buffer, from: string, to: string): Buffer;

declare namespace jconv {
    interface Encoding {
        name: string;
        convert: (buf: Buffer) => Buffer;
    }

    /*
     * Adds a new encoding. Already used internally with SJIS, JIS and EUCJP.
     */
    function defineEncoding(obj: Encoding): void;

    /*
     * Converts a Buffer from one encoding straight to another, and returns a new Buffer.
     */
    function convert(buf: Buffer, from: string, to: string): Buffer;

    /*
     * Decodes a Buffer with the given encoding to a string.
     */
    function decode(buf: Buffer, from: string): string;

    /*
     * Encodes a string to a Buffer with a given encoding.
     */
    function encode(str: string, to: string): Buffer;

    /*
     * Checks whether an encoding exists.
     */
    function encodingExists(encoding: string): boolean;
}

export = jconv;

Additional Details

  • Last updated: Tue, 07 Nov 2023 0337 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Martijn Saly.