Skip to content
Start here

Posts a file to Binary Storage

client.cloudforceOne.binaryStorage.create(BinaryStorageCreateParams { account_id, file } params, RequestOptionsoptions?): BinaryStorageCreateResponse { content_type, md5, sha1, sha256 }
POST/accounts/{account_id}/cloudforce-one/binary

Posts a file to Binary Storage

Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
Accepted Permissions (at least one required)
Cloudforce One WriteCloudforce One Read
ParametersExpand Collapse
params: BinaryStorageCreateParams { account_id, file }
account_id: string

Path param: Account ID.

Body param: The binary file content to upload.

ReturnsExpand Collapse
BinaryStorageCreateResponse { content_type, md5, sha1, sha256 }
content_type: string
md5: string
sha1: string
sha256: string

Posts a file to Binary Storage

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const binaryStorage = await client.cloudforceOne.binaryStorage.create({
  account_id: 'account_id',
  file: fs.createReadStream('path/to/file'),
});

console.log(binaryStorage.content_type);
{
  "content_type": "text/plain",
  "md5": "5d84ade76d2a8387c81175bb0cbe6492",
  "sha1": "9aff6879626d957eafadda044e4f879aae1e7278",
  "sha256": "0000a7f2692ef479e2e3d02661568882cadec451cc8a64d4e7faca29810cd626"
}
Returns Examples
{
  "content_type": "text/plain",
  "md5": "5d84ade76d2a8387c81175bb0cbe6492",
  "sha1": "9aff6879626d957eafadda044e4f879aae1e7278",
  "sha256": "0000a7f2692ef479e2e3d02661568882cadec451cc8a64d4e7faca29810cd626"
}