@samlior/http-client
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@samlior/http-client

@samlior/http-client is an interruptible HTTP client based on JSONRPC.

Install

npm install @samlior/http-client

Usage

import { HTTPClient } from "@samlior/http-client";

const client = new HTTPClient("https://aaa.bbb.ccc");

const { aborter, getResult } = client.request("method", "params");

getResult
  .then((response) => console.log("response:", response))
  .catch((err) => console.log("error:", err));

process.on("SIGINT", () => {
  aborter.abort(new Error("SIGINT"));
  // OR
  // client.abort(new Error("SIGINT"));

  // do something...

  process.exit(0);
});

/@samlior/http-client/

    Package Sidebar

    Install

    npm i @samlior/http-client

    Weekly Downloads

    1

    Version

    2.0.1

    License

    GPL-3.0-or-later

    Unpacked Size

    9.14 kB

    Total Files

    8

    Last publish

    Collaborators

    • samlior_