Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

pastebin-api

casperiv019.6kMIT7.0.0TypeScript support: included

A very simple npm package to interact with the pastebin api.

pastebin, hastebin, paste, pastebin-api

readme

pastebin-api

License Downloads

A very simple npm package to interact with the pastebin api.

Features

  • Create pastes with all the available API data
  • Fetch the raw contents of a paste
  • Fetch pastes from the authenticated user via a user login
  • Delete pastes from the authenticated user via a user login

Installation

# npm
npm install pastebin-api

# Yarn
yarn add pastebin-api

# pnpm
pnpm add pastebin-api

Note > pastebin-api requires node.js version 14 or higher.

Usage

// src/main.js
import { PasteClient, Publicity, ExpireDate } from "pastebin-api";
// const { PasteClient, Publicity, ExpireDate } = require("pastebin-api"); // using CommonJS

// Tip: load dev key from a `.env` file
const client = new PasteClient("DEV_KEY_HERE");

/* ... */

Documentation

You can checkout the documentation here

Support

All stars/forks are appreciated! ⚡

Feel free to open a pull request with a new feature.

Made with ❤️ and TypeScript!

License

MIT © Casper Iversen

changelog

Changelog

7.0.0

  • Upgrade deps
  • BREAKING: Require Node.js v18 or higher.

6.1.0

  • Fix: dist was not uploaded.

6.0.0

  • Move npm handle from @casper124578 to @casperiv

5.1.6

  • bump dependencies
  • Move to pnpm

5.1.5

  • bump dependencies

5.1.4

5.1.3

5.1.2

5.1.1

  • Bump dependencies

5.1.0

  • Bump dependencies
  • BREAKING: PasteClient#login now requires an object instead of 2 params. ➡ const token = await client.login({ name: "user_name", password: "user_password" });

5.0.0

  • Bump dependencies
  • BREAKING: require node v14.

4.0.1

  • Bump dependencies

4.0.0

  • breaking: Remove PasteClient#setDomain, pass down custom domain via ClientOptions.
  • breaking: Publicity is now an enum.
  • breaking: ExpireDate is now an enum.
  • Improve error messages
  • Bump dependencies

3.0.4

  • Bump dependencies

3.0.3

  • Minor code improvements
  • Bump dependencies

3.0.2

  • Bump dependencies

3.0.1

  • Bump dependencies

3.0.0

  • Replace node-fetch with undici (17a5344)
  • Bump dependencies

2.6.1

  • Bump dependencies

2.6.0

  • Bump dependencies
  • feat: support getting raw paste docs

2.5.0

  • Bump dependencies

2.4.0

  • Bump dependencies
  • Bump node-fetch to 3.0.0.
    • -> pastebin-api still supports cjs. It may not work on older node versions though.

2.3.6

  • Bump dependencies

2.3.5

  • Fix cjs node-fetch ESM import

2.3.4

  • chore: bump dependencies

2.3.3

  • fix: correct error message for options
  • chore: bump dependencies

2.3.2

  • chore: update example
  • chore: bump dependencies

2.3.1

  • chore: bump dependencies

2.3.0

  • feat: support use custom domain (Thanks @Zxilly)

2.2.0

  • refactor: use TypeError over Error where needed
  • refactor: use Promise.reject over throw Error where needed
  • refactor: remove unneeded ?. in discord bot example
  • chore: bump dependencies
  • chore: use actions/setup-node@v2 for CI

2.1.2

  • chore: bump dependencies

2.1.1

  • chore: bump dependencies

2.1.0

  • feat: allow CommonJS imports again
  • chore: use esbuild

2.0.4

  • chore: bump dependencies

2.0.2 & 2.0.3

  • chore: Add custom ESLint config

2.0.1

  • new: able to import PasteClient via named exports (import { PasteClient } from "pastebin-api")
    • Old method still works too.
  • chore: replace type string with ApiPasteFormat for paste_format_short
  • chore: use Array.isArray instead of typeof
  • chore: update dependencies

2.0.0

BREAKING CHANGES:

- const PasteClient = require("pastebin-api").default;

+ import PasteClient from "pastebin-api";

1.0.6

  • fix: incorrect docs for PasteClient#deletePasteByKey

1.0.5

  • chore: Updated dependencies
  • chore: Added ESLint workflow file
  • chore: updated examples

1.0.4

  • chore: Updated dependencies

1.0.3

  • chore: Updated dependencies

1.0.2

  • feat: Support for folderKey
  • chore: Updated docs

1.0.1

  • fix: Fixed issue with paste name (#7). Thanks @2colours

1.0.0

  • fix: Creating a paste will now throw an error if name is longer than 100 characters

0.0.9

  • fix: Added errors when not providing required data
  • chore: Updated documentation

0.0.8

  • feat: Added documentation

0.0.7

  • feat: Added login, getPastesByUser and deletePasteByKey methods (docs to follow)
  • chore: Updated TypeScript to 4.2.2
  • chore: Added Changelog 🎉

0.0.6

  • fix: Fixed examples

0.0.5

  • fix: Fixed modules

0.0.4

  • feat: Added typings 🎉

0.0.3

  • fix: Fixed minor things in package.json

0.0.2

  • chore: Added examples
  • chore: Renamed HasteClient to PasteClient

0.0.1

  • Initial release