{"id":15669086,"url":"https://github.com/dcdunkan/deno_pastebin","last_synced_at":"2025-10-11T10:08:58.815Z","repository":{"id":62422467,"uuid":"448965327","full_name":"dcdunkan/deno_pastebin","owner":"dcdunkan","description":"Tiny Pastebin API wrapper for Deno","archived":false,"fork":false,"pushed_at":"2022-01-25T12:45:26.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-16T04:59:43.155Z","etag":null,"topics":["deno","pastebin","pastebin-api"],"latest_commit_sha":null,"homepage":"https://deno.land/x/deno_pastebin","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcdunkan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-17T16:21:05.000Z","updated_at":"2022-01-17T18:45:50.000Z","dependencies_parsed_at":"2022-11-01T17:31:30.248Z","dependency_job_id":null,"html_url":"https://github.com/dcdunkan/deno_pastebin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dcdunkan/deno_pastebin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdunkan%2Fdeno_pastebin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdunkan%2Fdeno_pastebin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdunkan%2Fdeno_pastebin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdunkan%2Fdeno_pastebin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcdunkan","download_url":"https://codeload.github.com/dcdunkan/deno_pastebin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcdunkan%2Fdeno_pastebin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006834,"owners_count":26084203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","pastebin","pastebin-api"],"created_at":"2024-10-03T14:21:29.281Z","updated_at":"2025-10-11T10:08:58.782Z","avatar_url":"https://github.com/dcdunkan.png","language":"TypeScript","readme":"# [Pastebin](https://pastebin.com) API wrapper for Deno [🦕](https://deno.land/)\n\nA tiny [Deno](https://deno.land/) module to interact with\n[Pastebin](https://pastebin.com)'s [API](https://pastebin.com/doc_api).\n\n- Deno module: \u003chttps://deno.land/x/deno_pastebin\u003e\n- Pastebin's official API documentation: \u003chttps://pastebin.com/doc_api\u003e\n\n### Credits\n\nThis module is a fork and improved [Deno](https://deno.land) version of\n[pastebin-api](https://github.com/Dev-CasperTheGhost/pastebin-api/) by\n[Dev-CasperTheGhost](https://github.com/Dev-CasperTheGhost). Credits goes to\nthem for the base.\n\n## Usage\n\nSimply import from the library and use the available methods. You have to create\nan account and use the\n[unique Developer API Key pastebin provides](https://pastebin.com/doc_api#1) in\norder to interact with the API service using this module.\n\n```ts\nimport { PasteClient } from \"https://deno.land/x/deno_pastebin/mod.ts\";\n\nconst client = new PasteClient(\"\u003cdevKey here\u003e\");\n```\n\nLet's create a new paste as a Guest. It does not require user keys.\n\n```ts\nconst url = await client.create({\n  // Required. The content (code) of the paste.\n  code: \"\u003ccontent of the paste\u003e\",\n\n  // Everything else, OPTIONALS.\n  // If empty, it will paste as guest.\n  // userKey: \"\u003cuser token here\u003e\",\n\n  // Defaults to \"Untitled\".\n  name: \"\u003ctitle for your paste\u003e\",\n  // 0 = public, 1 = unlisted, 2 = private\n  publicity: 0,\n  // Syntax-Highlighting format. Defaults to \"text\".\n  format: \"bf\", // BrainF*ck\n  // Defaults to \"N\" = never.\n  expireDate: \"10M\", // 10 Minutes\n  // Name of an existing folder to save the paste to.\n  folderKey: \"\u003cfolder name\u003e\",\n});\n\n// \"url\" is the URL to the new paste.\nconsole.log(url);\n```\n\nOh, wanna create pastes for the user? With user's account? Get a session token\nusing their password and username.\n\n```ts\nconst userKey = await client.login(\"username\", \"password\");\nconsole.log(userKey); // Keep it private.\n```\n\nThen you can use that `userKey` for further use, and it can be used to create\nnew pastes under their account.\n\n\u003e Just like before, try creating a paste but with the parameter `userKey`.\n\n```ts\nconst url = await client.create({\n  code: \"\u003ccontent of the paste\u003e\",\n  userKey: userKey,\n  // ...\n});\n```\n\n\u003e `url` is the URL to the new paste.\n\n## Available Methods\n\n- [Create a Paste](#create-a-paste) - `create`\n- [Login using username and password](#login-using-username-and-password) -\n  `login`\n- [Delete a paste](#delete-a-paste) - `deletePaste`\n- [Get Raw Paste](#get-raw-paste) - `getRaw`\n- [Get User's pastes](#get-users-pastes) - `getPastes`\n- [Get User account info](#get-user-account-info) - `getUser`\n\n### Create a Paste\n\nIn order to create a private paste or on behalf of a user, you need to get\n`userKey` first. [See how to get one](#login-using-username-and-password).\nOtherwise, the paste will be created in Guest mode, which you cannot delete or\nedit after it's creation.\n\n```ts\nconst client = new PasteClient(\"DEV_API_KEY\");\n\nconst url = await client.create({\n  code: \"const something = 'Hello World!'\",\n  expireDate: \"N\",\n  format: \"typescript\",\n  name: \"hello-world.ts\",\n  publicity: 0,\n});\n\nconsole.log(url);\n```\n\n#### Options\n\n| Name         | Type     | Description                                                                                  | Required |\n| ------------ | -------- | -------------------------------------------------------------------------------------------- | -------- |\n| `code`       | `string` | The code you want to push                                                                    | `true`   |\n| `expireDate` | `string` | Sets the expire date of the paste. [Available expiry dates](https://pastebin.com/doc_api#6). | `false`  |\n| `format`     | `string` | The Syntax format. See [available formats](https://pastebin.com/doc_api#5).                  | `false`  |\n| `name`       | `string` | The name of your paste (Limit of 100 characters)                                             | `false`  |\n| `publicity`  | `number` | `0` Public \\| `1` Unlisted \\| `2` Private                                                    | `false`  |\n| `folderKey`  | `string` | The folder key (id)                                                                          | `false`  |\n| `userKey`    | `string` | The user key got from [`client.login()`](#login-using-username-and-password)                 | `false`  |\n\n[Back to Methods](#available-methods)\n\n### Login using username and password\n\nThe `userKey` can be used for further usage like, Creating a new paste, Deleting\npastes created by that user, Getting user info and default settings, or to Get\nuser's private paste's raw content, etc.\n\n```ts\nconst client = new PasteClient(\"DEV_API_KEY\");\nconst userKey = await client.login(\"username\", \"password\");\nconsole.log(userKey);\n```\n\n#### Options\n\n| Name       | Type     | Description         | Required |\n| ---------- | -------- | ------------------- | -------- |\n| `name`     | `string` | The user's name     | `true`   |\n| `password` | `string` | The user's password | `true`   |\n\n[Back to Methods](#available-methods)\n\n### Delete a paste\n\nYou can only delete user-created (Not created as Guest) pastes. For that you\nneed `userKey`. [See how to get one](#login-using-username-and-password).\n\nYou also need the key of the paste you want to delete - `pasteKey`. Paste key is\nthe part of the url which comes after `pastebin.com/`.\n\nFor example, in `https://pastebin.com/abcd1234`, the `abcd1234` is the key of\nthe paste.\n\n```ts\nconst userKey = await client.login(\"username\", \"password\");\n// Will return true if deleted successfully.\nconst deleted = await client.deletePaste({\n  userKey: userKey,\n  pasteKey: \"paste-key-here\",\n});\nconsole.log(deleted);\n```\n\n#### Options\n\n| Name       | Type     | Description                                                                      | Required |\n| ---------- | -------- | -------------------------------------------------------------------------------- | -------- |\n| `userKey`  | `string` | The `userKey` returned from [`client.login`](#login-using-username-and-password) | `true`   |\n| `pasteKey` | `string` | The key (id) of the paste                                                        | `true`   |\n\n[Back to Methods](#available-methods)\n\n### Get Raw Paste\n\nYou can get the raw paste (code) of a paste using this method. To get raw public\nor unlisted paste, you can use,\n\n```ts\n// Get raw paste from URL\nconst fromUrl = await client.getRaw(\"https://pastebin.com/z2qSHJqf\");\n// Get raw paste from ID\nconst fromId = await client.getRaw(\"z2qSHJqf\");\n\n// =\u003e raw paste string\nconsole.log({ fromUrl, fromId });\n```\n\nTo get raw paste output of user's pastes including 'private' pastes,\n\n```ts\nconst userKey = await client.login(\"username\", \"password\");\n\n// Get raw paste using userKey.\nconst withUserKey = await pb.getRaw({\n  pasteKey: \"xxxxxxx\",\n  userKey: token,\n});\n\n// =\u003e raw paste string\nconsole.log(withUserKey);\n```\n\n#### Options\n\n| Name       | Type     | Description                                                                      | Required |\n| ---------- | -------- | -------------------------------------------------------------------------------- | -------- |\n| `userKey`  | `string` | The `userKey` returned from [`client.login`](#login-using-username-and-password) | `true`   |\n| `pasteKey` | `string` | The key (id) of the paste                                                        | `true`   |\n\n[Back to Methods](#available-methods)\n\n### Get User's pastes\n\nYou can list all the pastes created by a user using this method.\n\n```ts\nconst userKey = await client.login(\"username\", \"password\");\nconst pastes = await client.getPastes({\n  userKey: userKey,\n  limit: 100, // Min: 1, Max: 1000, Default: 50\n});\n// An array of pastes\nconsole.log(pastes);\n```\n\n#### Options\n\n| Name      | Type     | Description                                                                      | Required |\n| --------- | -------- | -------------------------------------------------------------------------------- | -------- |\n| `userKey` | `string` | The `userKey` returned from [`client.login`](#login-using-username-and-password) | `true`   |\n| `limit`   | `number` | The limit of pastes to get                                                       | `false`  |\n\n[Back to Methods](#available-methods)\n\n### Get User Account info\n\nYou can obtain a user's personal information and certain settings using this\nmethod.\n\n```ts\nconst userKey = await client.login(\"username\", \"password\");\nconst userInfo = await client.getUser(userKey);\nconsole.log(userInfo);\n```\n\n#### Options\n\n| Name      | Type     | Description                                                                      | Required |\n| --------- | -------- | -------------------------------------------------------------------------------- | -------- |\n| `userKey` | `string` | The `userKey` returned from [`client.login`](#login-using-username-and-password) | `true`   |\n\n[Back to Methods](#available-methods)\n\n---\n\nPull requests are welcome!\n\n**Made with ❤️**\n\n**Licensed under [MIT](./LICENSE) (c) 2022\n[dcdunkan](https://github.com/dcdunkan).**\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcdunkan%2Fdeno_pastebin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcdunkan%2Fdeno_pastebin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcdunkan%2Fdeno_pastebin/lists"}