A NodeJS SDK for Bunny.Net CDN.
The properties and methods mirror the endpoints described in the BunnyCDN API Documentation.
âš IMPORTANT: This package not anywhere near ready for use in actual projects. At this point it is an exercise in building an NPM package with TypeScript.
import BunnyCDN from '@8ctopotamus/bunnycdn'
// configure the SDK
const bunny = new BunnyCDN({
pullzone: process.env.BUNNY_NET_PULLZONE,
accessKey: process.env.BUNNY_NET_ACCESS_KEY,
storageZoneName: process.env.BUNNY_NET_STORAGEZONE_NAME,
storageZonePassword: process.env.BUNNY_NET_STORAGEZONE_PASSWORD,
storageZoneRegion: process.env.BUNNY_NET_STORAGEZONE_REGION, // may be excluded if not applicable
})
await bunny.storage.list('images')
const url = await bunny.storage.upload(`./img.jpg`, `images/img.jpg`)
await bunny.storage.download(`images/img.jpg`, `./img.jpg`)
await bunny.storage.delete(`images/img.jpg`)
Create and fill out a .env
file in the root of the project:
BUNNY_NET_PULLZONE=your_pullzone_name
BUNNY_NET_ACCESS_KEY=your_access_key
BUNNY_NET_STORAGEZONE_NAME=your_storagezone_name
BUNNY_NET_STORAGEZONE_PASSWORD=your_storagezone_password
BUNNY_NET_STORAGEZONE_REGION=your_storagezone_region_if_exists
Run npm run dev
and npm run test
in separate terminals
- Abuse Case
- Countries
- Billing
- Compute
- Support
- DRM Certificate
- Region
- Stream Video Library
- DNS Zone
- [...] Pull Zone
- Purge
- Statistics
- Storage Zone
- User
-
Manage Collections
- Get Collection
- Update Collection
- Delete Collection
- Get Collection List
- Create Collection
-
Manage Videos
- Get Videoget
- Update Videopost
- Delete Videodelete
- Upload Videoput
- Get Video Heatmapget
- Get Video Statisticsget
- Reencode Videopost
- List Videosget
- Create Videopost
- Set Thumbnailpost
- Fetch Videopost
- Add Captionpost
- Delete Caption