PartValue

org.http4s.multipart.PartValue
See thePartValue companion object
sealed trait PartValue

Generic representation of typical Multipart Part bodies, as either a string or a file path. Produced by MultipartReceiver.auto.

Similar to Part, but with less Header-oriented detail, and a clearer distinction between in-memory data vs on-disk data.

Attributes

Companion
object
Source
PartValue.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class OfFile
class OfString

Members list

Value members

Abstract methods

def bytes[F[_] : Files]: EntityBody[F]

Returns a byte-stream representation of the part's body.

Returns a byte-stream representation of the part's body.

For OfString parts, the underlying string is piped through a UTF-8 encoder. For OfFile parts, the underlying file's content will be read from disk.

Attributes

Returns

The part's body as a stream of bytes

Source
PartValue.scala
def fold[A](onString: String => A, onFile: (String, Path) => A): A

Fold over the different PartValue subtypes to compute a value

Fold over the different PartValue subtypes to compute a value

Value parameters

onFile

Called with the underlying filename and file path if this part is an OfFile

onString

Called with the underlying String if this part is an OfString

Attributes

Returns

The value returned by either onString or onFile

Source
PartValue.scala

Concrete methods

def toPart[F[_] : Files](name: String, headers: ToRaw*): Part[F]

Builds a new Part from this PartValue.

Builds a new Part from this PartValue.

Value parameters

headers

Any extra headers to add to the part. Content-Disposition is added automatically based on the name, and in the case of OfFile parts, the filename

name

The name of the part

Attributes

Returns

a new Part based on the given name, applicable filename, and body of this PartValue.

Source
PartValue.scala