bunny-vault
v1.10.10
Published
A powerful Node.js SDK for BunnyCDN storage management.
Maintainers
Readme
BunnyVault - BunnyCDN Storage SDK
BunnyVault is a simple and efficient Node.js SDK for interacting with BunnyCDN Storage. It allows you to upload, delete, list, and manage files effortlessly.
🚀 Features
- 📂 Create Folder: Easily create folders in BunnyCDN storage.
- 📤 Upload Files: Upload files to a specified folder.
- 🗑 Delete Files: Remove files from BunnyCDN storage.
- 📜 List Files: Get a list of all files in a folder.
- ⚡ Simple & Lightweight: Easy-to-use API with minimal dependencies.
📦 Installation
Install bunny-vault via npm:
npm install bunny-vault@latest🛠 Usage
1️⃣ Import & Initialize
const BunnyStorage = require("bunny-vault");
const storage = new BunnyStorage({
storageZone: "your-storage-zone",
apiKey: "your-api-key",
});2️⃣ Create a Folder
storage.createFolder("my-folder").then(console.log);3️⃣ Upload a File
const fs = require("fs");
const file = {
originalname: "example.jpg",
buffer: fs.readFileSync("./example.jpg"),
mimetype: "image/jpeg"
};
storage.uploadFile(file, "my-folder").then(console.log);4️⃣ List Files in a Folder
storage.listFiles("my-folder").then(console.log);5️⃣ Delete a File
storage.deleteFile("my-folder/example.jpg").then(console.log);📜 API Reference
🔹 new BunnyStorage({ storageZone, apiKey })
Initializes the storage client.
🔹 createFolder(folderPath)
Creates a folder in BunnyCDN storage.
🔹 uploadFile(file, folderPath)
Uploads a file to a specific folder.
🔹 listFiles(folderPath)
Returns a list of files inside a folder.
🔹 deleteFile(filePath)
Deletes a file from storage.
📌 Notes
- Make sure your API key is correct.
- Use the correct storage region endpoint.
🔥 License
This project is licensed under the MIT License.
