You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

sourcebin

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sourcebin

Fast and simple package to get and create bins from https://sourceb.in/

5.0.0-next.0
Source
npmnpm
Version published
Weekly downloads
511
-21.26%
Maintainers
1
Weekly downloads
 
Created
Source

Sourcebin

Fast and simple package to get and create bins from sourcebin

Requirements

NodeJS >= 14.x

Install

npm install sourcebin

Docs

This README is the best place to learn how to use this package, you can also take a look at our API docs

Setup

// Import individual methods
import { create, get, url } from 'sourcebin';

// Import all methods
import * as sourcebin from 'sourcebin';

// Use required
const { create, get, url } = require('sourcebin');

Get a bin

get(options)

const bin = await get({
    key: 'qXO2NVhRc6'
});

Options

OptionDescriptionDefaultRequired
keyThe key to getn/a
fetchContentShould the bin content be fetchedtrue

Create a bin

create(options)

const bin = await create(
    {
        title: 'bin name',
        description: 'test bin',
        files: [
            {
                content: 'Hello World',
                language: 'text',
            },
        ],
    },
);

Options

OptionDescriptionRequired
titleTitle of the bin
descriptionDescription of the bin
filesBin files - see below

File Options

OptionDescriptionDefaultRequired
contentContents of the filen/a
languageWhat language should the file betext

Url Helper

If you want to get information about a bin try the url function.

const urlData = url('iQznILdZRP');

// or

const urlData = url('https://sourceb.in/iQznILdZRP');

This returns an object that looks like:

{
  key: 'iQznILdZRP',
  url: 'https://sourceb.in/iQznILdZRP',
  short: 'http://srcb.in/iQznILdZRP'
}

FAQ

  • Multiple files in one bin

    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

  • Migrate from v4 to v5

    v5 is a overhaull of sourcebin so we changed some apis.

    Get a bin

    Instead of passing the key then options it's now one object.

    - const bin = await get('qXO2NVhRc6');
    + const bin = await get({ key: 'qXO2NVhRc6' });
    
    - const bin = await get('qXO2NVhRc6', { fetchContent: false });
    + const bin = await get({ key: 'qXO2NVhRc6', fetchContent: false });
    

    Create a bin

    We also unified the options for this function:

    - const bin = await create(
    -    [
    -        {
    -            content: 'Hello World',
    -            language: 'text',
    -        },
    -    ],
    -    {
    -        title: 'bin name',
    -        description: 'test bin',
    -    },
    - );
    
    + const bin = await create(
    +   {
    +       title: 'bin name',
    +       description: 'test bin',
    +       files: [
    +           {
    +               content: 'Hello World',
    +               language: 'text',
    +           },
    +       ],
    +   }
    +  );
    

Support

Keywords

sourcebin

FAQs

Package last updated on 05 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts