Skip to content

Commit 953b0ee

Browse files
committed
docs: update readme
1 parent 016e68f commit 953b0ee

1 file changed

Lines changed: 12 additions & 80 deletions

File tree

README.md

Lines changed: 12 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,19 @@
11
# Sourcebin
22

3-
[![](https://img.shields.io/npm/v/sourcebin?label=Latest%20Version&style=for-the-badge&logo=npm&color=informational)](https://www.npmjs.com/package/sourcebin)
4-
[![](https://img.shields.io/static/v1?label=Project%20Creator&message=GHOST&color=informational&style=for-the-badge)](https://ghostdev.xyz)
5-
[![](https://img.shields.io/github/workflow/status/ghostdevv/sourcebin/Test%20Suite%20CI?style=for-the-badge)](https://github.com/ghostdevv/sourcebin)
6-
73
Fast and simple package to get and create bins from [sourcebin](https://sourceb.in/)
84

95
# Requirements
106

11-
```
12-
NodeJS >= 14.x
13-
```
14-
15-
# Install
16-
17-
```
18-
npm install sourcebin
19-
```
20-
21-
# Docs
22-
23-
This README is the best place to learn how to use this package, you can also [take a look at our API docs](https://ghostdevv.github.io/sourcebin/index.html)
24-
25-
# Setup
26-
27-
```js
28-
// Import individual methods
29-
import { create, get, url } from 'sourcebin';
30-
31-
// Import all methods
32-
import * as sourcebin from 'sourcebin';
33-
34-
// Use required
35-
const { create, get, url } = require('sourcebin');
36-
```
7+
Node >= 22.13
378

389
# Get a bin
3910

4011
`get(options)`
4112

4213
```js
43-
const bin = await get({
44-
key: 'qXO2NVhRc6',
45-
});
14+
import { get } from 'sourcebin';
15+
16+
const bin = await get({ key: 'qXO2NVhRc6' });
4617
```
4718

4819
## Options
@@ -57,6 +28,8 @@ const bin = await get({
5728
`create(options)`
5829

5930
```js
31+
import { create } from 'sourcebin';
32+
6033
const bin = await create({
6134
title: 'bin name',
6235
description: 'test bin',
@@ -112,55 +85,14 @@ This returns an object that looks like:
11285

11386
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
11487

88+
- ## Migrate from v5 to v6
89+
90+
This was just a maintenance release and the API hasn't actually changed. You will need to use Node `>=22.13` or above, as we removed the dependency on axios in favour of [native `fetch`](https://nodejs.org/docs/latest-v22.x/api/globals.html#fetch). Additionally, this package is now esm only which shouldn't cause any problems thanks to [`require(esm)`](https://nodejs.org/docs/latest-v25.x/api/modules.html#loading-ecmascript-modules-using-require), but if you experience [any issues please open one](https://github.com/ghostdevv/sourcebin/issues/new).
91+
11592
- ## Migrate from v4 to v5
11693

117-
v5 is a overhaull of `sourcebin` so we changed some apis.
118-
119-
### Get a bin
120-
121-
Instead of passing the `key` then `options` it's now one object.
122-
123-
```diff
124-
- const bin = await get('qXO2NVhRc6');
125-
+ const bin = await get({ key: 'qXO2NVhRc6' });
126-
127-
- const bin = await get('qXO2NVhRc6', { fetchContent: false });
128-
+ const bin = await get({ key: 'qXO2NVhRc6', fetchContent: false });
129-
```
130-
131-
### Create a bin
132-
133-
We also unified the options for this function:
134-
135-
```diff
136-
- const bin = await create(
137-
- [
138-
- {
139-
- content: 'Hello World',
140-
- language: 'text',
141-
- },
142-
- ],
143-
- {
144-
- title: 'bin name',
145-
- description: 'test bin',
146-
- },
147-
- );
148-
149-
+ const bin = await create(
150-
+ {
151-
+ title: 'bin name',
152-
+ description: 'test bin',
153-
+ files: [
154-
+ {
155-
+ content: 'Hello World',
156-
+ language: 'text',
157-
+ },
158-
+ ],
159-
+ }
160-
+ );
161-
```
94+
[See the README from a v5 release](https://github.com/ghostdevv/sourcebin/blob/611318be1b4aff17d19f80df20b73908ddf53376/README.md#migrate-from-v4-to-v5)
16295

16396
# Support
16497

165-
- Join the [discord](https://discord.gg/2Vd4wAjJnm)
166-
- Create a issue on the [github](https://github.com/ghostdevv/sourcebin)
98+
- Create a issue on the [github](https://github.com/ghostdevv/sourcebin/issues/new)

0 commit comments

Comments
 (0)