Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boywithkeyboard-archive/bunny.net
JavaScript SDK for 🐇 bunny.net
https://github.com/boywithkeyboard-archive/bunny.net
bunny bunnycdn cdn cjs cloud-storage dns esm javascript sdk storage typescript
Last synced: 3 days ago
JSON representation
JavaScript SDK for 🐇 bunny.net
- Host: GitHub
- URL: https://github.com/boywithkeyboard-archive/bunny.net
- Owner: boywithkeyboard-archive
- License: apache-2.0
- Created: 2023-03-31T17:08:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-24T06:18:21.000Z (about 2 months ago)
- Last Synced: 2024-10-01T22:53:42.247Z (about 1 month ago)
- Topics: bunny, bunnycdn, cdn, cjs, cloud-storage, dns, esm, javascript, sdk, storage, typescript
- Language: TypeScript
- Homepage: https://npmjs.com/bunny.net
- Size: 106 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
## bunny.net(.js)
### Setup
#### Deno
```ts
import { Client } from 'https://esm.sh/bunny.net'
```#### Node.js
```bash
npm i bunny.net
``````ts
import { Client } from 'bunny.net'
```### Usage
> [!IMPORTANT]
> You need to open a [bunny.net](https://bunny.net) account first to use this module. After you have signed up, you can get your API token [here](https://dash.bunny.net/account/settings).```ts
const bunny = new Client({
token: '...'
})
```### Guide
#### Error Handling
All functions return an object with the `data` and `error` properties. The `error` property is either `true` or `false`, depending on the status code of the response.
If the `error` property is `false`, you can access the response data in the `data` property.
```ts
const { data, error } = await bunny.method()if (!error) {
// do smth with response data
} else {
// handle error
}
```#### Debugging
If you encounter issues, you should enable **debug mode**.
```ts
new Client({
debug: true
})
```If the response from the API is erroneous, the response body is printed out on the console in addition to the behavior described above.