Attributes
- Companion
- trait
- Source
- MultipartReceiver.scala
- Graph
-
- Supertypes
- Self type
-
MultipartReceiver.type
Members list
Type members
Classlikes
Attributes
- Source
- MultipartReceiver.scala
- Supertypes
Types
Attributes
- Source
- MultipartReceiver.scala
Value members
Concrete methods
Attributes
- Source
- MultipartReceiver.scala
Creates a MultipartReceiver which inspects each Part's headers to decide whether to receive each Part as text or as a file upload.
Creates a MultipartReceiver which inspects each Part's headers to decide whether to receive each Part as text or as a file upload.
Parts that look like file uploads will have their content written to a temp file, represented with PartValue.OfFile. All other parts will be decoded to text, represented with PartValue.OfString. Each part's name is used as a key in the resulting Map[String, PartValue].
Type parameters
- F
-
The effect type
Attributes
- Returns
-
A
MultipartReceiverwhich builds aMapcontaining eachPart, where the map's key is the part name, and value is the decoded part, represented as either plain text or as a temporary file. - Source
- MultipartReceiver.scala
Creates a MultipartReceiver which handles all parts the same way, using the given partReceiver.
Creates a MultipartReceiver which handles all parts the same way, using the given partReceiver.
Note that the resulting MultipartReceiver does not inherently capture any metadata about each Part; only the decoded values are returned as a List. The given partReceiver can be constructed to provide the necessary metadata, e.g. by using PartReceiver.withPartName
Example usage:
val genericReceiver: MultipartReceiver[IO, Map[String, Stream[IO, Byte]]] =
MultipartReceiver.uniform(
PartReceiver
.toMixedBuffer[IO](maxSizeBeforeFile = 10 * 1024 * 1024)
.withPartName
).map(_.toMap)
The above passes a PartReceiver.toMixedBuffer to load part data into memory up to a certain per-part limit, dumping the buffer to a temporary file after that limit is reached. The buffer for each part is exposed as a generic byte stream which can safely be re-read until the underlying buffers are released. The withPartName method transforms the PartReceiver to include the Part name so we can return a convenient Map representation of the result.
Type parameters
- A
-
The value type returned by the
partReceiver - F
-
The effect type
Value parameters
- partReceiver
-
The
PartReceiverto use for each part
Attributes
- Returns
-
A
MultipartReceiverwhich delegates to the givenpartReceiverfor all parts, returning aListof all parts' decoded values. - Source
- MultipartReceiver.scala
Implicits
Implicits
Attributes
- Source
- MultipartReceiver.scala