8000 GitHub - ardalanamini/node-kutt: Node.js client for Kutt.to url shortener · GitHub
[go: up one dir, main page]

Skip to content
ardalanaminiPublic

About

Node.js client for Kutt.to url shortener

Topics

Resources

Code of conduct

Stars

42 stars

Watchers

1 watching

Forks

Repository files navigation

Kutt

Node.js & browser (TypeScript) client for Kutt url shortener.

Latest Version CI Monthly NPM Downloads Total NPM Downloads NPM Bundle Size (minified) NPM Bundle Size (minified + gzip) Known Vulnerabilities Pull Requests License Github Stars Github Forks

Installation

Requires Node.js >=22. This package uses ECMAScript modules (ESM).

pnpm add kutt

or

npm i kutt

Usage

Create a client and shorten a URL:

import { Kutt } from "kutt";

const kutt = new Kutt().setAPIKey("YOUR_API_KEY");

const link = await kutt.links().createV2({
  target: "https://example.com/article",
  customURL: "article",
  expireIn: "2 days",
});

console.log(link.link);

const page = await kutt.links().listV2({ limit: 10 });
console.log(page.data);

You can also call endpoints directly:

import { listKuttLinksV2 } from "kutt";

const page = await listKuttLinksV2({
  limit: 10,
  apiKey: "YOUR_API_KEY",
});

Set defaults before creating clients, including when using a self-hosted Kutt server:

import { KUTT_CONFIG, Kutt } from "kutt";

KUTT_CONFIG
  .setBaseURL("https://kutt.example.com/api/")
  .setAPIKey("YOUR_API_KEY");

const kutt = new Kutt();
const isHealthy = await kutt.health().checkV2();

Clients copy the defaults when constructed. Each API group copies its client's configuration when created.

Documentation

See the full API documentation for all endpoints, configuration options, response types, and error handling.

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Node.js client for Kutt.to url shortener

Topics

Resources

Code of conduct

Stars

42 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages

0