This wrapper is designed to easily create and get bins from sourcebin. You are also able to shorten the sourcebin links.
npm install sourcebin --save
const sourcebin = require('sourcebin');
sourcebin.create([ bin-objects ], { options })
sourcebin.create([
{
name: 'File Name (optional)',
content: 'This bin was made using npmjs.org/sourcebin',
languageId: 'text'
}
]).then(console.log)
.catch(console.error);
/*
Add a title and/or description
*/
sourcebin.create([
{
name: 'File Name (optional)',
content: 'This bin was made using npmjs.org/sourcebin',
languageId: 'text'
}
], {
title: 'Hello World!',
description: 'My test sourcebin'
}).then(console.log)
.catch(console.error);
Syntax:
sourcebin.get("key or sourcebin url")
Example:
sourcebin.get("62cbad45ff")
.then(console.log)
.catch(console.error);
Syntax:
sourcebin.shorten("key or sourcebin url")
Example:
var shortLink = sourcebin.shorten("62cbad45ff");
Sample output for the get and create methods:
{
"key": "62cbad45ff",
"url": "https://sourceb.in/62cbad45ff",
"short": "http://srcb.in/62cbad45ff",
"title": undefined,
"description": undefined,
"created": "2020-04-25T20:32:28.462Z",
"files": [
{
"raw": "https://sourceb.in/raw/62cbad45ff/0",
"name": undefined,
"content": "This bin was made using npmjs.org/sourcebin",
"languageId": 372,
"language": {
"name": "Text",
"extension": "txt",
"aliases": [
"fundamental"
],
"aceMode": "text"
},
}
]
}
Sample output for the shorten method:
http://srcb.in/62cbad45ff
You can message me on discord: GHOST#7524
or create a issue on the github