Fast and simple package to get and create bins from sourcebin
NodeJS >= 10.x
npm install sourcebin
Node JS
const sourcebin = require('sourcebin');
TypeScript
import { get, create, url } from 'sourcebin';
For es imports such as the TypeScript import it's recommened you only import the methods you need
sourcebin.get(key or url, options)
const bin = await sourcebin.get('qXO2NVhRc6');
fetchContent
- whether to fetch bin content or not (default true)
sourcebin.create([ files ], options)
const bin = await sourcebin.create(
[
{
content: 'Hello World',
language: 'text',
},
],
{
title: 'bin name',
description: 'test bin',
},
);
name
- file name
content
- file content (required)
language
- language or language id (default text)
title
- bin title
description
- bin description
-
sourcebin.url(key or url)
const { url, short } = url('qXO2NVhRc6');
- This is not currently possible with this wrapper as sourcebin doesn't have a token system for authentication, only pro users are able to have multiple files in one bin. This may come in the future