# @mrxbox98/hastebin-js

> A simple hastebin client for uploading things to hastebin.com

Latest version **1.0.0** (published 2021-09-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mrxbox98/hastebin-js
pnpm add @mrxbox98/hastebin-js
yarn add @mrxbox98/hastebin-js
bun add @mrxbox98/hastebin-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-09-07 |
| First published | 2021-09-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | Jacz |
| Maintainers | mrxbox98 |
| Keywords | hastebin, haste-server, haste, paste |

## Links

- npm: https://www.npmjs.com/package/@mrxbox98/hastebin-js
- Repository: https://github.com/MrJacz/hastebin-gen
- Homepage: https://github.com/MrJacz/hastebin-gen#readme
- Issues: https://github.com/MrJacz/hastebin-gen/issues
- npm.io page: https://npm.io/package/@mrxbox98/hastebin-js

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0

## Recent versions

- 1.0.0 (latest) — 2021-09-07

## README

[![npm](https://img.shields.io/npm/v/npm.svg)](https://www.npmjs.com/package/hastebin-paste)
[![npm downloads](https://img.shields.io/npm/dt/hastebin-paste.svg?maxAge=3600)](https://www.npmjs.com/package/hastebin-paste)
[![Open Source Love](https://badges.frapsoft.com/os/mit/mit.svg?v=102)](https://github.com/ellerbrock/open-source-badge/)
[![dependencies Status](https://david-dm.org/Absolute-Development/hastebin-paste/status.svg)](https://david-dm.org/Absolute-Development/hastebin-haste)
[![devDependencies Status](https://david-dm.org/Absolute-Development/hastebin-paste/dev-status.svg)](https://david-dm.org/Absolute-Development/hastebin-paste?type=dev)
[![NPM](https://nodei.co/npm/hastebin-paste.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/hastebin-paste/)


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



## Installation

**NPM:** `npm i hastebin-paste`

# Options

Option      | Type     | Default Value
----------- | -------- | ---------------------------------------------
`url`       | `string` | `"https://hastebin.com"`
`extension` | `string` | `"txt"`
`message`   | `string` | `"Powered by hastebin-paste, a npm package."`
`prefix`    | `string` | `"The link is: "`
## Examples

**Using .then().catch()**

```javascript
const hastebin = require("hastebin-paste");

// You can change the extension(ex. "js", "txt", default: "txt") 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**](https://hackernoon.com/understanding-async-await-in-javascript-1d81bb079b2c)

```javascript
const hastebin = require("hastebin-paste");

// 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**](https://github.com/seejohnrun/haste-server) instance

**Using .then().catch()**

```javascript
const hastebin = require("hastebin-paste");

// 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**](https://hackernoon.com/understanding-async-await-in-javascript-1d81bb079b2c)

```javascript
const hastebin = require("hastebin-paste");

// 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
```

**Using Message and Prefix option**
```js
const hastebin = require("hastebin-paste");
 
// You can change the extension by setting the extension option
hastebin("code", { url: "https://paste.example.com", extention: "txt", message: "example", prefix: "example" }).then(haste => {//set message that comes after the link or set the prefix that comes before the link
    console.log(haste)// Logs the created hastebin url and message you set to the console
    //the output will be "example https://paste.example.com/someid.txt example"
}).catch(error => {
    // Handle error
    console.error(error);
});
```

---
_Source: https://npm.io/package/@mrxbox98/hastebin-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
