Big news!Introducing Socket AI - ChatGPT-Powered Threat Analysis. Learn more
Socket
Log inDemoInstall

hastebin-gen

Package Overview
Dependencies
1
Maintainers
1
Versions
17
Issues
File Explorer

Advanced tools

hastebin-gen

A simple hastebin client for uploading things to hastebin.com

    2.0.5latest
    GitHub

Version published
Maintainers
1
Weekly downloads
624
decreased by-56.55%

Weekly downloads

Readme

Source

Discord npm npm downloads NPM version Build Status Open Source Love dependencies Status devDependencies Status NPM

hastebin-gen

A npm module for generating hastebin links. https://www.npmjs.com/package/hastebin-gen

Installation

NPM: npm i hastebin-gen

Yarn: yarn add hastebin-gen

Options

OptionTypeDefault Value
urlstring"https://hastebin.com"
extensionstring"js"

Examples

Using .then().catch()

const hastebin = require("hastebin-gen"); // You can change the extension by setting the extension option hastebin("code", { extension: "txt" }).then(haste => { // Logs the created hastebin url to the console console.log(haste); // https://hastebin.com/someid.txt }).catch(error => { // Handle error console.error(error); });

Using async/await

This is assuming that you are in a asynchronous scope

Understanding Async/Await

const hastebin = require("hastebin-gen"); // You can change the extension by setting the extension option const haste = await hastebin("code", { extension: "txt" }); // Logs the created hastebin url to the console console.log(haste); // https://hastebin.com/someid.txt

Example with a custom haste-server instance

Using .then().catch()

const hastebin = require("hastebin-gen"); // You can change the extension by setting the extension option hastebin("code", { url: "https://paste.example.com", extension: "txt" }).then(haste => { // Logs the created hastebin url to the console console.log(haste); // https://paste.example.com/someid.txt }).catch(error => { // Handle error console.error(error); });

Using async/await

This is assuming that you are in a asynchronous scope

Understanding Async/Await

const hastebin = require("hastebin-gen"); // You can change the extension by setting the extension option const haste = await hastebin("code", { url: "https://paste.example.com", extension: "txt" }); // Logs the created hastebin url to the console console.log(haste); // https://paste.example.com/someid.txt

FAQs

Last updated on 30 May 2019

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc