Node.js & browser (TypeScript) client for Kutt url shortener.
npm i kuttconst Kutt = require("kutt").default;or
const { Kutt } = require("kutt");import Kutt from "kutt";or
import { Kutt } from "kutt";const api: string = Kutt.get("api");
const key: string = Kutt.get("key");
const timeout: number = Kutt.get("timeout");Kutt
.set("api", "https://kutt.it/api/v2") // API base url (Default value)
.set("key", "") // API key (Default value)
.set("timeout", 1e4); // Request timeout (Default value)const kutt = new Kutt();Override the default config only for the instance.
const api: string = kutt.get("api");
const key: string = kutt.get("key");
const timeout: number = kutt.get("timeout");kutt
.set("api", "https://kutt.it/api/v2") // API base url
.set("key", "") // API key
.set("timeout", 1e4); // Request timeoutconst domains = kutt.domains();Create a domain.
const domain = await domains.create({
address: "string",
homepage: "string",
});Delete a domain.
const message = await domains.remove(domain.id);const health = kutt.health();Check API health.
const isHealthy = await health.check();const links = kutt.links();Get list of links.
const result = await links.list();You can also pass in pagination params.
const result = await links.list({
skip: 0, // Default value
limit: 10, // Default value
all: 10, // Default value
});Create a short link.
const link = await links.create({
target: "string",
description: "string",
expire_in: "2 minutes/hours/days",
password: "string",
customurl: "string",
reuse: false,
domain: "string",
});Get link stats.
const stats = await links.stats(link.id);Update a link.
const updatedLink = await links.update(link.id, {
target: "string",
address: "string",
description: "string",
expire_in: "2 minutes/hours/days",
});Delete a link.
const message = await links.remove(link.id);const users = kutt.users();Get user info.
const info = await users.info();We use SemVer for versioning. For the versions available, see the releases on this repository.
- Ardalan Amini - Core Maintainer - @ardalanamini
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details