Skip to content
Playground(another site)

bynk.types.file_at_boundary

Error A File (a file part of a multipart request), or a type carrying one, is used where it would be persisted, sent across a boundary or returned.

A File is one uploaded part of a @multipart request, held in memory for the handler that receives it. A record may have a File field, alone, in an Option or in a List, which is how a @multipart body names its parts. But a File, or a record carrying one, is refused as an agent store field or key, an event field, a handler result, or any handler parameter but that body. Take the part's bytes, and the filename and contentType you need, in the handler, and keep those.

Example

consumes bynk { File }
agent Gallery {
key id: String
store photo: Cell[Option[File]] // ✗ an upload is not kept as a `File`
}
agent Gallery {
key id: String
store photo: Cell[Option[Bytes]] // ✓ keep its bytes
}

In the Book

See also

  • Every code in its category, Type checking, on the diagnostic index.
  • bynk explain bynk.types.file_at_boundary shows the same from the installed toolchain, without a network.