def form.split

emerging-ezhttp@0.21.0.0 · src/form.bend:297

import emerging-ezhttp@0.21.0.0/src/form.bend as Form
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

297# the parts as the plan sees them, and the files' bytes in order; `d` is
298# the delimiter's octets, one character each
299def form.split(+d: String, us: List<&1, Upload>)
300  -> List<&2, Part> & List<&1, Bytes.Bytes>:
301  match us:
302    case []:
303      ([], [])
304    case u <> t:
305      match u:
306        case UField{name, value}:
307          form.split.field(name, value, form.split(d, t))
308        case UFile{name, filename, ctype, bytes}:
309          form.split.file(name, filename, ctype,
310            form.found(Bytes.find(bytes, d)), form.split(d, t))

Uses (11)

Used by (1)