@flamedeck/upload NPM package. This library offers a convenient function to send trace data directly to the Flamedeck API.
Installation
You can install the package using npm or yarn:Basic Usage
The core of the library is theuploadTraceToApi function. You’ll need to import it along with the necessary types.
Prerequisites
Example (Node.js)
Here’s a TypeScript example demonstrating how to upload a trace file from a Node.js environment:Example (Browser)
When using in a browser environment (e.g., from a file input):UploadOptions Interface
TheuploadTraceToApi function accepts an options object conforming to the UploadOptions interface:
The content of the trace file. Use File/Blob for browser, ArrayBuffer for Node.js.
Set to
true to make the trace publicly accessible. Defaults to false (private).For detailed descriptions of optional fields like
commitSha, branch, notes, folderId, and metadata, please refer to the CLI Upload documentation, as they serve the same purpose.Error Handling
TheuploadTraceToApi function will throw an UploadError if the upload fails. This custom error object contains:
status: HTTP status code (if applicable)message: Error messagedetails: Additional error information from the API

