cloudflare
Version:
The official TypeScript library for the Cloudflare API
45 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Download = exports.BaseDownload = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const headers_1 = require("../../../internal/headers.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseDownload = /* @__PURE__ */ (() => {
class BaseDownload extends resource_1.APIResource {
/**
* Download PCAP information into a file. Response is a binary PCAP file.
*
* @example
* ```ts
* const download =
* await client.magicTransit.pcaps.download.get(
* '023e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
*
* const content = await download.blob();
* console.log(content);
* ```
*/
get(pcapID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/pcaps/${pcapID}/download`, {
...options,
headers: (0, headers_1.buildHeaders)([{ Accept: 'application/vnd.tcpdump.pcap' }, options?.headers]),
__binaryResponse: true,
});
}
}
BaseDownload._key = Object.freeze([
'magicTransit',
'pcaps',
'download',
]);
return BaseDownload;
})();
exports.BaseDownload = BaseDownload;
class Download extends BaseDownload {
}
exports.Download = Download;
//# sourceMappingURL=download.js.map