-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
110 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 0 additions & 94 deletions
94
...ve/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/model/ArchiveFormat.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...gins/archive/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/archive/model/Zip.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ch.epfl.bluebrain.nexus.delta.plugins.archive.model | ||
|
||
import akka.NotUsed | ||
import akka.http.scaladsl.model.{ContentType, HttpRequest, MediaTypes} | ||
import akka.stream.alpakka.file.scaladsl.Archive | ||
import akka.stream.alpakka.file.ArchiveMetadata | ||
import akka.stream.scaladsl.{Flow, Source} | ||
import akka.util.ByteString | ||
import ch.epfl.bluebrain.nexus.delta.sdk.utils.HeadersUtils | ||
|
||
/** | ||
* Zip archive format | ||
* | ||
* @see | ||
* https://en.wikipedia.org/wiki/ZIP_(file_format)#Limits for the limitations | ||
*/ | ||
object Zip { | ||
type WriteFlow[Metadata] = Flow[(Metadata, Source[ByteString, _]), ByteString, NotUsed] | ||
|
||
def apply(req: HttpRequest): Option[Zip.type] = | ||
if (HeadersUtils.matches(req.headers, Zip.contentType.mediaType)) Some(Zip) else None | ||
|
||
def contentType: ContentType = MediaTypes.`application/zip` | ||
|
||
def fileExtension: String = "zip" | ||
|
||
def metadata(filename: String): ArchiveMetadata = | ||
ArchiveMetadata.create(filename) | ||
|
||
def writeFlow: WriteFlow[ArchiveMetadata] = Archive.zip() | ||
|
||
def ordering: Ordering[ArchiveMetadata] = Ordering.by(md => md.filePath) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.