1.1.6 • Published 3 years ago

easybin v1.1.6

Weekly downloads
7
License
ISC
Repository
-
Last release
3 years ago

EasyBin

The easy way to upload text on the most popular paste sites

Installation

Current stable release (1.1.1)

$ npm install --save easybin

Loading and configuring the module

We suggest you load the module via require until the stabilization of ES modules in node:

const easybin = require('easybin');

To configure the module use the use function To configure the hastebin module edit the hastebin:{} settings and to edit the pastebin module edit the pastebin{} settings

easybin.use({
    hastebin: {
        server: "https://paste.soniq.tech"
    },

    pastebin: {
        apikey: "DEV_KEY"
    }
})

#Common and Basic Usage Chose your paste site. (Hastebin and Pastebin as of right now)

Hastebin

To post some simple text use the easybin.hastebin() module.

easybin.hastebin("Hello, World!")

To get the link back you would need to await the response This is an example of a simple function to upload some text and return the results

async function upload(text) {
    const response = await easybin.hastebin(text) 
    return response;
}

This would return some json that looks like this

{
  "key": "aaaaaaaaa",
  "url": "https://hastebin.com/aaaaaaaaa",
  "raw": { "key": "aaaaaaaaa" }
}

You can then get the actual url by getting the url object from the response

async function upload(text) {
    const response = await easybin.hastebin(text) 
    return response.url;
}

You can also define settings per module that will override global settings by using the second argument as options

easybin.hastebin("Hello World!", {server: "https://paste.soniq.tech"})

Pastebin

To post some simple text use the easybin.pastebin() module. Make sure to set your pastebin api key

easybin.pastebin("Hello, World!")

To get the link back you would need to await the response This is an example of a simple function to upload some text and return the results

async function upload(text) {
    const response = await easybin.pastebin("Hello, World!") 
    return response;
}

This would return some json that looks like this

{
  "key": "aaaaaaaaa",
  "url": "https://pastebin.com/aaaaaaaaa"
}

You can then get the actual url by getting the url object from the response

async function upload(text) {
    const response = await easybin.pastebin("Hello, World!") 
    return response.url;
}

You can also define settings per module that will override global settings by using the second argument as options such as using a different api key

easybin.pastebin("Hello World!", {apikey: "DEV_KEY"})

Support

For support with easybin join https://discord.soniq.tech

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago