0.0.34 • Published 6 months ago

@types/msgpack v0.0.34

Weekly downloads
646
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/msgpack

Summary

This package contains type definitions for msgpack.js - MessagePack JavaScript Implementation (https://github.com/uupaa/msgpack.js/).

Details

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

index.d.ts

// Type definitions for msgpack.js - MessagePack JavaScript Implementation
// Project: https://github.com/uupaa/msgpack.js/
// Definitions by: Shinya Mochizuki <https://github.com/enrapt-mochizuki/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace msgpack {
  interface MsgPackStatic {
    /**
     * @param data string or ByteArray.
     * @param toString return string value if true.
     *
     * @return string or ByteArray or false. pack failed if false.
     */
    pack(data: any, toString?: boolean): any;

    /**
     * @param data string or ByteArray.
     *
     * @return string or ByteArray or undefined. unpack failed if undefined.
     */
    unpack(data: any): any;

    worker: string;

    upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void;

    download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void;
  }

  interface MsgPackUploadOption {
    /**
     * string or ByteArray
     */
    data: any;

    /**
     * use WebWorker if true.
     */
    worker?: boolean | undefined;

    /**
     * timeout sec.
     */
    timeout?: number | undefined;

    before?: ((xhr: XMLHttpRequest, option: MsgPackUploadOption) => void) | undefined;

    after?: ((xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void) | undefined;
  }

  interface MsgPackUploadCallback {
    (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void;
  }

  interface MsgPackDownloadOption {
    /**
     * use WebWorker if true.
     */
    worker?: boolean | undefined;

    /**
     * timeout sec.
     */
    timeout?: number | undefined;

    before?: ((xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void) | undefined;

    after?: ((xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void) | undefined;
  }

  interface MsgPackDownloadCallback {
    /**
     * @param data string or ByteArray
     */
    (data: any, option: MsgPackDownloadOption, result: MsgPackCallbackResult): void;
  }

  interface MsgPackCallbackResult {
    status: number;

    ok: boolean;
  }
}

declare var msgpack: msgpack.MsgPackStatic;

export = msgpack;
export as namespace msgpack;

Additional Details

  • Last updated: Thu, 08 Jul 2021 18:51:02 GMT
  • Dependencies: none
  • Global values: msgpack

Credits

These definitions were written by Shinya Mochizuki.

0.0.32

8 months ago

0.0.33

7 months ago

0.0.34

6 months ago

0.0.31

3 years ago

0.0.30

7 years ago

0.0.29

7 years ago

0.0.28

8 years ago

0.0.27

8 years ago

0.0.26-alpha

8 years ago

0.0.25-alpha

8 years ago

0.0.24-alpha

8 years ago

0.0.23-alpha

8 years ago

0.0.22-alpha

8 years ago

0.0.21-alpha

8 years ago

0.0.20-alpha

8 years ago

0.0.15-alpha

8 years ago

0.0.14-alpha

8 years ago