Skip to main content

Overview

Every DeviceClient instance includes a cdn property for uploading files (screenshots, logs, sensor data exports) to the Lua CDN and downloading files from it. The CDN is authenticated using the same API key as the device connection.

Methods

upload

Upload a file to the CDN. Returns a CdnUploadResult with the file ID and public URL.
data
Buffer | Blob
required
File content as a Node.js Buffer or Blob.
filename
string
required
Filename including extension (e.g., screenshot.png, sensor-log.csv).
contentType
string
MIME type (e.g., image/png, text/csv). Defaults to application/octet-stream.
Returns: CdnUploadResult

download

Download a file from the CDN by its file ID.
fileId
string
required
The file ID returned from a previous upload.
Returns: Buffer containing the file content.

getUrl

Get the public URL for a file without downloading it.
fileId
string
required
The file ID returned from a previous upload.
Returns: string — the full CDN URL.

Use Cases

Screenshots

Kiosk devices capturing screen state for debugging or audit.

Sensor Logs

Periodic CSV or JSON exports of accumulated sensor readings.

Photos

Camera-equipped devices uploading inspection photos.

Firmware Reports

Diagnostic reports uploaded for agent analysis.

Example: Screenshot Upload

A kiosk device that takes a screenshot when the agent requests it and uploads it to the CDN:

Next Steps

Node.js Client

Full client reference including CDN property

Retail Kiosk Example

Complete kiosk example with CDN uploads

API Reference

CDN class method signatures