npm

@intelrug/bunnycdn
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

@intelrug/bunnycdn

NPM Version Package License NPM Downloads

Install

$ yarn add @intelrug/bunnycdn

Usage

import

import { BunnyCDN } from '@intelrug/bunnycdn';
...
const bunny = new BunnyCDN({
    apiAccessKey: 'your-key',
    storageZones: [{
        name: 'your-storage-zone-name',
        accessKey: 'your-storage-zone-access-key'
    }],
});
...

Storage

All files in Storage Zone

const files: StorageZoneFile[] = await bunny.storage.get('your-storage-zone-name');

Get contents of specific file

const fileContents: string = await bunny.storage
    .getFile('your-storage-zone-name', 'somepath/script.js');

Create a file or update contents of specific file

bunny.storage.update(
    'your-storage-zone-name',
    'somepath/script.js',
    'console.log(\'I was updated\');'
);

Delete specific file

bunny.storage.delete('your-storage-zone-name', 'somepath/script.js');

Bunny API

Get Billing

const billing: Billing = await bunny.billing();

Get Statistics

const stats : Statistic = await bunny.statistics();

Purge File Cache

bunny.purge('http://your-zone/somepath/filetopurge.css');

HardUpdate File (Update and Purge)

bunny.hardUpdate(
    'https://your-domain.com',
    'your-storage',
    'somepath',
    'fileName.css',
    'new file contents'
);

Readme

Keywords

none

Package Sidebar

Install

npm i @intelrug/bunnycdn

Weekly Downloads

1

Version

0.1.3

License

MIT

Unpacked Size

63.4 kB

Total Files

60

Last publish

Collaborators

  • intelrug