https://github.com/j3lte/pastedeno
Universal Pastebin client for Deno/Node
https://github.com/j3lte/pastedeno
deno nodejs paste pastebin pastebin-api pastebin-js pastebin-ts
Last synced: 10 months ago
JSON representation
Universal Pastebin client for Deno/Node
- Host: GitHub
- URL: https://github.com/j3lte/pastedeno
- Owner: j3lte
- License: mit
- Created: 2023-11-20T16:59:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-05T23:42:28.000Z (over 1 year ago)
- Last Synced: 2025-04-02T23:02:33.978Z (11 months ago)
- Topics: deno, nodejs, paste, pastebin, pastebin-api, pastebin-js, pastebin-ts
- Language: TypeScript
- Homepage: https://deno.land/x/pastedeno
- Size: 138 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PasteDeno
[](https://github.com/j3lte/pastedeno/releases/latest "GitHub release (latest by date)")
[](https://www.npmjs.com/package/pastedeno "NPM Version")
[](https://github.com/j3lte/pastedeno/releases/latest "GitHub Release Date")

[](https://github.com/j3lte/pastedeno/blob/main/LICENSE "GitHub License")
[](https://github.com/j3lte/pastedeno/commits/main "GitHub last commit")
[](https://github.com/j3lte/pastedeno/issues "Github Issues")
[](https://github.com/j3lte/pastedeno/actions/workflows/test.yml "GitHub Workflow Status")
[](https://codecov.io/gh/j3lte/pastedeno "Codecov")
[](https://doc.deno.land/https/deno.land/x/pastedeno/mod.ts "Deno docs")
Pastebin Client for Deno/Node
> This is a continuation of [pastebin-ts](https://github.com/j3lte/pastebin-ts) and its predecessor [pastebin-js](https://github.com/j3lte/pastebin-js). The main difference between Pastedeno and its predecessors is that it is completely rewritten and uses less dependencies (and up-to-date ones). Alongside the Deno version a Node version is automatically published to NPM.
## Capabilities
### Pastebin API
- Create a new paste (with optional title, format, privacy and expiration)
- Get a paste (raw)
- Delete a paste
- Get user info
- Get user pastes
### Scraper [(PRO only)](https://pastebin.com/doc_scraping_api)
- Scrape latest pastes
- Get raw paste
- Get paste metadata
## Packages used
For the Deno version the following packages are used:
- [xml](https://deno.land/x/xml) (for parsing XML) ([MIT License](https://github.com/lowlighter/xml/blob/main/LICENSE))
- [evt](https://deno.land/x/evt) (for event handling in Scraper) ([MIT License](https://github.com/garronej/evt/blob/main/LICENSE))
For the Node version the following packages are used:
- [fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser) (for parsing XML) ([MIT License](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/LICENSE))
- [evt](https://www.npmjs.com/package/evt) (for event handling in Scraper) ([MIT License](https://github.com/garronej/evt/blob/main/LICENSE))
- [node-fetch](https://www.npmjs.com/package/node-fetch) (for fetching data) ([MIT License](https://github.com/node-fetch/node-fetch/blob/main/LICENSE.md))
## API
API Docs can be found on Deno Docs: [https://deno.land/x/pastedeno/mod.ts](https://deno.land/x/pastedeno/mod.ts)
## Installation
### Deno
```ts
import { Pastebin } from "https://deno.land/x/pastedeno/mod.ts";
```
### Node
Run `npm install pastedeno` or `yarn add pastedeno`
```ts
import { Pastebin } from "pastedeno";
```
## Usage
### Pastebin API
```ts
import { Pastebin, PrivacyLevel, ExpirationTime } from "https://deno.land/x/pastedeno/mod.ts";
// Create a new Pastebin instance
const pastebin = new Pastebin({
api_dev_key: "",
api_user_name: "",
api_user_password: "",
})
// Create a new paste
const paste = await pastebin.createPaste({
code: "console.log('Hello World!')",
title: "Hello World",
format: "javascript",
privacy: PrivacyLevel.PRIVATE,
expiration: ExpirationTime.ONE_DAY
});
// paste = 'https://pastebin.com/XXXXXXXX'
// Get the raw paste (either use the paste url or the paste id)
const raw = await pastebin.getPaste('https://pastebin.com/XXXXXXXX');
// Get the raw private paste
const rawPrivate = await pastebin.getPaste('https://pastebin.com/XXXXXXXX', true);
// Delete the paste
await pastebin.deletePaste('');
// Get user info
const userInfo = await pastebin.getUserInfo();
// Get user pastes
const userPastes = await pastebin.listUserPastes();
// Set debug mode
pastebin.setDebug(true);
```
### Scraper [(PRO only)](https://pastebin.com/doc_scraping_api)
```ts
import { Scraper } from "https://deno.land/x/pastedeno/mod.ts";
const scraper = new Scraper({
intervalTime: 5000,
limit: 10,
});
scraper.on("scrape", (data) => {
console.table(data);
});
scraper.on("new", (data) => {
console.log(`New paste: ${data.key}`);
});
scraper.on("error", (error) => {
console.error(error);
});
scraper.start();
```
## License
[MIT](LICENSE)
---
[](https://www.buymeacoffee.com/j3lte)