UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

39 lines 1.27 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../resource.mjs"; import * as Core from "../../core.mjs"; export class BinaryStorage extends APIResource { /** * Posts a file to Binary Storage * * @example * ```ts * const binaryStorage = * await client.cloudforceOne.binaryStorage.create({ * account_id: 'account_id', * file: fs.createReadStream('path/to/file'), * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/cloudforce-one/binary`, Core.multipartFormRequestOptions({ body, ...options })); } /** * Retrieves a file from Binary Storage * * @example * ```ts * await client.cloudforceOne.binaryStorage.get('hash', { * account_id: 'account_id', * }); * ``` */ get(hash, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/cloudforce-one/binary/${hash}`, { ...options, headers: { Accept: '*/*', ...options?.headers }, }); } } //# sourceMappingURL=binary-storage.mjs.map