{"id":27249620,"url":"https://github.com/jacxk/sourcebin-wrapper","last_synced_at":"2025-04-11T00:18:24.227Z","repository":{"id":57366499,"uuid":"248078594","full_name":"Jacxk/Sourcebin-Wrapper","owner":"Jacxk","description":"Create and get bins from https://sourceb.in/","archived":false,"fork":false,"pushed_at":"2020-07-24T03:21:44.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T14:05:11.633Z","etag":null,"topics":["sourcebin","sourcebin-wrapper","sourcebinapi","wrapper"],"latest_commit_sha":null,"homepage":null,"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/Jacxk.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":"2020-03-17T21:41:23.000Z","updated_at":"2020-07-24T03:21:46.000Z","dependencies_parsed_at":"2022-08-23T20:10:46.260Z","dependency_job_id":null,"html_url":"https://github.com/Jacxk/Sourcebin-Wrapper","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacxk%2FSourcebin-Wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacxk%2FSourcebin-Wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacxk%2FSourcebin-Wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jacxk%2FSourcebin-Wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jacxk","download_url":"https://codeload.github.com/Jacxk/Sourcebin-Wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317823,"owners_count":21083541,"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","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":["sourcebin","sourcebin-wrapper","sourcebinapi","wrapper"],"created_at":"2025-04-11T00:18:22.643Z","updated_at":"2025-04-11T00:18:24.216Z","avatar_url":"https://github.com/Jacxk.png","language":"TypeScript","readme":"# SourceBin Wrapper\n\n[![](https://img.shields.io/npm/v/sourcebin-wrapper?label=Latest%20Version\u0026style=for-the-badge)](https://www.npmjs.com/package/sourcebin-wrapper)\n[![](https://img.shields.io/github/issues-raw/Jacxk/sourcebin-wrapper?label=Open%20Issues\u0026style=for-the-badge)](https://github.com/Jacxk/Sourcebin-Wrapper/issues)\n[![](https://img.shields.io/npm/dw/sourcebin-wrapper?label=Downloads\u0026style=for-the-badge)](https://www.npmjs.com/package/sourcebin-wrapper)\n[![](https://img.shields.io/github/package-json/author/Jacxk/sourcebin-wrapper?style=for-the-badge)](https://www.npmjs.com/package/sourcebin-wrapper)\n\n\nWith this wrapper you can create and get bins from https://sourceb.in/\n\n### Install\n`npm i sourcebin-wrapper --save`\n\n### Initialize\n```javascript\n// typescript\nimport * as SourceBin from 'sourcebin-wrapper';\n\n// Node/JavaScript\nconst SourceBin = require('sourcebin-wrapper');\n```\n\n# Methods\n### create([BinFile], BinOptions?)\n```javascript\nSourceBin.create([\n    new SourceBin.BinFile({\n        name: 'index.js',\n        content: 'This was created using the wrapper\\n\\nlanguageId: \"js\"',\n        languageId: 'js'\n    })\n], {\n    title: 'Some test',\n    description: 'This is awesome'\n})\n    .then(console.log)\n    .catch(console.error);\n\n```\nLanguage defaults to **Text**, if invalid or no language provided.\n\n### upload(path, BinOptions?)\n```js\n// Upload single file\nSourceBin.upload('path/to/file', { title: 'Upload file' })\n    .then(console.log)\n    .catch(console.error);\n\n// Upload entire folder\nSourceBin.upload('path/to/folder', { title: 'Upload folder' })\n    .then(console.log)\n    .catch(console.error);\n```\nLanguage is detected by the file extension, and name as well.\n\n### newBin(contents, lang?, name?, BinOptions?)\n```js\nSourceBin.newBin('Using wrapper', 'txt', 'wrapper', {\n    title: 'Some test',\n    description: 'This is awesome'\n})\n    .then(console.log)\n    .catch(console.error);\n```\n\n### get(url | key)\n```javascript\n// Get bin using its key\nSourceBin.get(\"d4ad855543\").then(console.log);\n\n// Get bin using its url\nSourceBin.get(\"https://sourceb.in/d4ad855543\").then(console.log);\n```\n\n#### Sample Output\nOutput for both **create** and **get**\n```json\n{\n  \"key\": \"d4ad855543\",\n  \"url\": \"https://sourceb.in/d4ad855543\",\n  \"shortened\": \"https://srcb.in/d4ad855543\",\n  \"created\": \"2020-03-17T21:12:30.549Z\",\n  \"files\": [\n    {\n      \"raw\": \"https://sourceb.in/raw/d4ad855543/0\",\n      \"content\": \"This was created using the wrapper\\n\\nlanguageId: \\\"js\\\"\",\n      \"languageId\": 183,\n      \"language\": {\n        \"name\": \"JavaScript\",\n        \"extension\": \"js\",\n        \"aliases\": [\n          \"js\",\n          \"node\"\n        ],\n        \"aceMode\": \"javascript\"\n      }\n    }\n  ]\n}\n```\n\n# Options\n\n#### BinFileOptions:\nThis is for creating BinFiles\n\n* `content`: The contents of what you're uploading\n* `name` \\\u003coptional\u003e: The name of the file to be uploaded\n* `languageId`\\\u003coptional\u003e: Language of the contents you're uploading\n\n#### BinOptions:\nThis is for creating Bins\n\n* `title`\\\u003coptional\u003e: The title of the bin\n* `description`\\\u003coptional\u003e: The description of the bin\n\n*Note: BinFile is for the contents of each Bin. A Bin can contain multiple BinFiles*","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacxk%2Fsourcebin-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacxk%2Fsourcebin-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacxk%2Fsourcebin-wrapper/lists"}