upload-to-bunny
v1.3.1
Published
Upload-to-Bunny is a Node.JS library designed to simplify and speed up the process of uploading directories to BunnyCDN storage.
Downloads
94
Maintainers
Readme
Upload-to-Bunny
Upload-to-Bunny is a Node.JS library designed to simplify and speed up the process of uploading directories to BunnyCDN storage. With built-in support for parallel uploads and deleting old files, this library makes it easy to keep your BunnyCDN storage up-to-date.
Features
- Upload entire directories to BunnyCDN storage
- Parallel uploads for faster transfers
- Option to clean the destination before uploading
- Easily configurable with storage zone and access key
Installation
npm install --save upload-to-bunny
Usage
To use the Upload-to-Bunny library, simply import it and call the uploadToBunny
function with the appropriate options:
uploadToBunny(sourceDirectory, destinationDirectory, options);
Example
import uploadToBunny from 'upload-to-bunny';
await uploadToBunny('/path/to/local/directory', '', {
storageZoneName: 'your-storage-zone-name',
cleanDestination: true,
accessKey: 'your-bunny-access-key',
maxConcurrentUploads: 10
});
Options
The uploadToBunny
function accepts the following options:
storageZoneName
(string, required): The name of your BunnyCDN storage zone.cleanDestination
(boolean, optional): If set totrue
, the target directory will be cleaned before uploading. Default isfalse
.accessKey
(string, required): Your BunnyCDN access key.maxConcurrentUploads
(number, optional): The maximum number of files to upload concurrently. Default is 10.
Example
import uploadToBunny from 'upload-to-bunny';
await uploadToBunny('/path/to/local/directory', '', {
storageZoneName: 'test-storage-12345',
cleanDestination: true,
accessKey: 'xxxxxxxxxx-xxxx-xxxx-xxxx',
maxConcurrentUploads: 10
});
Contributing
Contributions are always welcome! If you have any suggestions, bug reports, or feature requests, feel free to open an issue or submit a pull request.