Interface FileUploadDirectives

All Known Subinterfaces:
Directives
All Known Implementing Classes:
Directives$, FileUploadDirectives$, HttpApp

public interface FileUploadDirectives
  • Method Summary

    Modifier and Type
    Method
    Description
    Directive<scala.Tuple1<scala.Tuple2<FileInfo,akka.stream.scaladsl.Source<akka.util.ByteString,Object>>>>
    fileUpload(String fieldName)
    Collects each body part that is a multipart file as a tuple containing metadata and a Source for streaming the file contents somewhere.
    Directive<scala.Tuple1<scala.collection.immutable.Seq<scala.Tuple2<FileInfo,akka.stream.scaladsl.Source<akka.util.ByteString,Object>>>>>
    fileUploadAll(String fieldName)
    Collects each body part that is a multipart file as a tuple containing metadata and a Source for streaming the file contents somewhere.
    Directive<scala.Tuple2<FileInfo,File>>
    storeUploadedFile(String fieldName, scala.Function1<FileInfo,File> destFn)
    Streams the bytes of the file submitted using multipart with the given file name into a designated file on disk.
    Directive<scala.Tuple1<scala.collection.immutable.Seq<scala.Tuple2<FileInfo,File>>>>
    storeUploadedFiles(String fieldName, scala.Function1<FileInfo,File> destFn)
    Streams the bytes of the file submitted using multipart with the given field name into designated files on disk.
  • Method Details

    • storeUploadedFile

      Directive<scala.Tuple2<FileInfo,File>> storeUploadedFile(String fieldName, scala.Function1<FileInfo,File> destFn)
      Streams the bytes of the file submitted using multipart with the given file name into a designated file on disk. If there is an error writing to disk the request will be failed with the thrown exception, if there is no such field the request will be rejected, if there are multiple file parts with the same name, the first one will be used and the subsequent ones ignored.

      Parameters:
      fieldName - (undocumented)
      destFn - (undocumented)
      Returns:
      (undocumented)
    • storeUploadedFiles

      Directive<scala.Tuple1<scala.collection.immutable.Seq<scala.Tuple2<FileInfo,File>>>> storeUploadedFiles(String fieldName, scala.Function1<FileInfo,File> destFn)
      Streams the bytes of the file submitted using multipart with the given field name into designated files on disk. If there is an error writing to disk the request will be failed with the thrown exception, if there is no such field the request will be rejected. Stored files are cleaned up on exit but not on failure.

      Parameters:
      fieldName - (undocumented)
      destFn - (undocumented)
      Returns:
      (undocumented)
    • fileUpload

      Directive<scala.Tuple1<scala.Tuple2<FileInfo,akka.stream.scaladsl.Source<akka.util.ByteString,Object>>>> fileUpload(String fieldName)
      Collects each body part that is a multipart file as a tuple containing metadata and a Source for streaming the file contents somewhere. If there is no such field the request will be rejected, if there are multiple file parts with the same name, the first one will be used and the subsequent ones ignored.

      Parameters:
      fieldName - (undocumented)
      Returns:
      (undocumented)
    • fileUploadAll

      Directive<scala.Tuple1<scala.collection.immutable.Seq<scala.Tuple2<FileInfo,akka.stream.scaladsl.Source<akka.util.ByteString,Object>>>>> fileUploadAll(String fieldName)
      Collects each body part that is a multipart file as a tuple containing metadata and a Source for streaming the file contents somewhere. If there is no such field the request will be rejected. Files are buffered into temporary files on disk so in-memory buffers don't overflow. The temporary files are cleaned up once materialized, or on exit if the stream is not consumed.

      Parameters:
      fieldName - (undocumented)
      Returns:
      (undocumented)