-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #796 from scala-js/compression
Add Compression APIs
- Loading branch information
Showing
6 changed files
with
81 additions
and
0 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
14 changes: 14 additions & 0 deletions
14
dom/src/main/scala-2/org/scalajs/dom/CompressionFormat.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,14 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
@js.native | ||
sealed trait CompressionFormat extends js.Any | ||
|
||
object CompressionFormat { | ||
val deflate: CompressionFormat = "deflate".asInstanceOf[CompressionFormat] | ||
|
||
val `deflate-raw`: CompressionFormat = "deflate-raw".asInstanceOf[CompressionFormat] | ||
|
||
val gzip: CompressionFormat = "gzip".asInstanceOf[CompressionFormat] | ||
} |
13 changes: 13 additions & 0 deletions
13
dom/src/main/scala-3/org/scalajs/dom/CompressionFormat.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,13 @@ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
|
||
opaque type CompressionFormat <: String = String | ||
|
||
object CompressionFormat { | ||
val deflate: CompressionFormat = "deflate" | ||
|
||
val `deflate-raw`: CompressionFormat = "deflate-raw" | ||
|
||
val gzip: CompressionFormat = "gzip" | ||
} |
19 changes: 19 additions & 0 deletions
19
dom/src/main/scala/org/scalajs/dom/CompressionStream.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,19 @@ | ||
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API | ||
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later. | ||
* http://creativecommons.org/licenses/by-sa/2.5/ | ||
* | ||
* Everything else is under the MIT License http://opensource.org/licenses/MIT | ||
*/ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation._ | ||
import scala.scalajs.js.typedarray.Uint8Array | ||
|
||
/** An API for compressing a stream of data. */ | ||
@js.native | ||
@JSGlobal | ||
class CompressionStream(format: CompressionFormat) extends js.Object { | ||
def readable: ReadableStream[Uint8Array] = js.native | ||
def writable: WriteableStream[Uint8Array] = js.native | ||
} |
19 changes: 19 additions & 0 deletions
19
dom/src/main/scala/org/scalajs/dom/DecompressionStream.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,19 @@ | ||
/** All documentation for facades is thanks to Mozilla Contributors at https://developer.mozilla.org/en-US/docs/Web/API | ||
* and available under the Creative Commons Attribution-ShareAlike v2.5 or later. | ||
* http://creativecommons.org/licenses/by-sa/2.5/ | ||
* | ||
* Everything else is under the MIT License http://opensource.org/licenses/MIT | ||
*/ | ||
package org.scalajs.dom | ||
|
||
import scala.scalajs.js | ||
import scala.scalajs.js.annotation._ | ||
import scala.scalajs.js.typedarray.Uint8Array | ||
|
||
/** An API for decompressing a stream of data. */ | ||
@js.native | ||
@JSGlobal | ||
class DecompressionStream(format: CompressionFormat) extends js.Object { | ||
def readable: ReadableStream[Uint8Array] = js.native | ||
def writable: WriteableStream[Uint8Array] = js.native | ||
} |