@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:
Your Flamedeck API key.
The content of the trace file. Use File/Blob for browser, ArrayBuffer for Node.js.
The original filename.
A descriptive name for the trace.
The Git commit SHA associated with this trace.
The Git branch name associated with this trace.
Free-form text notes to attach to the trace.
The UUID of an existing folder to upload the trace into.
Set to
true to make the trace publicly accessible. Defaults to false (private).Custom key-value metadata to associate with the trace.
Override the default Supabase functions base URL (for self-hosted or testing).
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

