js-cloudflare
v0.2.0
Published
A Cloudflare Worker compatible image api client
Downloads
9
Readme
Cloudflare JS bindings
Cloudflare v4 API bindings for JS (ie. Cloudflare Worker compatible), providing a sourdough "BREAD" (Browse, Read, Edit, Add, and Delete) interface.
Currently Supported Operations
Images
Configuration
Import the endpoints you'll need and instantiate them.
import { Images } from 'js-cloudflare';
const cfImageClient = new Images({
accountIdentifier: YOUR_ACCOUNT_IDENTIFIER,
bearerToken: YOUR_API_TOKEN,
rootPath: 'customPrefix'
});
const result = await cfImageClient.getImageById('ce743595-39f3-4105-8d97-caeb3d69cf1f');
Response
{
"errors": [],
"messages": [],
"result": {
"filename": "logo.png",
"id": "ce743595-39f3-4105-8d97-caeb3d69cf1f",
"meta": {
"key": "value"
},
"requireSignedURLs": true,
"uploaded": "2014-01-02T02:20:00.123Z",
"variants": [
"https://imagedelivery.net/MTt4OTd0b0w5aj/ce743595-39f3-4105-8d97-caeb3d69cf1f/thumbnail",
"https://imagedelivery.net/MTt4OTd0b0w5aj/ce743595-39f3-4105-8d97-caeb3d69cf1f/hero",
"https://imagedelivery.net/MTt4OTd0b0w5aj/ce743595-39f3-4105-8d97-caeb3d69cf1f/original"
]
},
"success": true
}
Roadmap
- Complete the Images API endpoints (CRUD)
- Open for suggestions