UploadFile

class UploadFile(val contentType: String, val fileName: String, val sizeBytes: Long? = null, val openStream: () -> InputStream)

A host-provided file payload for every host-rendered upload. A plain class, not a data class: it has identity equality, so the enclosing StepInput values do too — never compare upload inputs by value.

Constructors

Link copied to clipboard
constructor(contentType: String, fileName: String, sizeBytes: Long? = null, openStream: () -> InputStream)

Properties

Link copied to clipboard

MIME type, e.g. "image/jpeg" or "application/pdf". It labels the upload; Engine and the backend decide what the file is from its bytes.

Link copied to clipboard
Link copied to clipboard

Opens a fresh, readable stream of the bytes, on a background thread. Engine calls this more than once — to check the file's first bytes, then to send it — so it must return a NEW stream each time; Engine closes every stream it opens. Whatever it throws while Engine checks the file, Engine treats the file as unreadable, like an empty one. A stream keeps a large file out of memory; a small in-memory payload is UploadFile(type, name, bytes.size.toLong()) { bytes.inputStream() }.

Link copied to clipboard

Byte length if known — lets Engine set Content-Length, report upload progress, and refuse a file over the backend's 20 MiB limit before sending it.