Skip to content

Commit

Permalink
Updated zlib functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ldaniels528 committed Mar 13, 2017
1 parent a8f43b8 commit bcccb5c
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.scalajs.nodejs.zlib

import io.scalajs.nodejs.stream

import scala.scalajs.js

/**
* Compression Algorithm
* @author [email protected]
*/
@js.native
trait CompressionAlgorithm extends js.Object
trait CompressionAlgorithm extends stream.Readable with stream.Writable
3 changes: 2 additions & 1 deletion src/main/scala/io/scalajs/nodejs/zlib/Deflate.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/io/scalajs/nodejs/zlib/DeflateRaw.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/io/scalajs/nodejs/zlib/Gunzip.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand All @@ -7,4 +8,4 @@ import scala.scalajs.js
* @author [email protected]
*/
@js.native
trait Gunzip extends CompressionAlgorithm
trait Gunzip extends CompressionAlgorithm
3 changes: 2 additions & 1 deletion src/main/scala/io/scalajs/nodejs/zlib/Gzip.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand Down
5 changes: 3 additions & 2 deletions src/main/scala/io/scalajs/nodejs/zlib/Inflate.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand All @@ -7,4 +8,4 @@ import scala.scalajs.js
* @author [email protected]
*/
@js.native
trait Inflate extends CompressionAlgorithm
trait Inflate extends CompressionAlgorithm with stream.Readable
3 changes: 2 additions & 1 deletion src/main/scala/io/scalajs/nodejs/zlib/InflateRaw.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/io/scalajs/nodejs/zlib/Unzip.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.scalajs.nodejs.zlib
package io.scalajs.nodejs
package zlib

import scala.scalajs.js

Expand Down
12 changes: 6 additions & 6 deletions src/main/scala/io/scalajs/nodejs/zlib/Zlib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,37 +81,37 @@ trait Zlib extends IEventEmitter {
* Returns a new DeflateRaw object with an options.
* @example zlib.createDeflateRaw(options)
*/
def createDeflateRaw(options: CompressionOptions | RawOptions): DeflateRaw = js.native
def createDeflateRaw(options: CompressionOptions | RawOptions = js.native): DeflateRaw = js.native

/**
* Returns a new Gunzip object with an options.
* @example zlib.createGunzip(options)
*/
def createGunzip(options: CompressionOptions | RawOptions): Gunzip = js.native
def createGunzip(options: CompressionOptions | RawOptions = js.native): Gunzip = js.native

/**
* Returns a new Gzip object with an options.
* @example zlib.createGzip(options)
*/
def createGzip(options: CompressionOptions | RawOptions): Gzip = js.native
def createGzip(options: CompressionOptions | RawOptions = js.native): Gzip = js.native

/**
* Returns a new Inflate object with an options.
* @example zlib.createInflate(options)
*/
def createInflate(options: CompressionOptions | RawOptions): Inflate = js.native
def createInflate(options: CompressionOptions | RawOptions = js.native): Inflate = js.native

/**
* Returns a new InflateRaw object with an options.
* @example zlib.createInflateRaw(options)
*/
def createInflateRaw(options: CompressionOptions | RawOptions): InflateRaw = js.native
def createInflateRaw(options: CompressionOptions | RawOptions = js.native): InflateRaw = js.native

/**
* Returns a new Unzip object with an options.
* @example zlib.createUnzip(options)
*/
def createUnzip(options: CompressionOptions | RawOptions): Unzip = js.native
def createUnzip(options: CompressionOptions | RawOptions = js.native): Unzip = js.native

/**
* Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm.
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/io/scalajs/nodejs/zlib/ZlibTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ZlibTest extends FunSpec {

describe("Zlib") {

it("should compress strings or buffer") {
it("should compress strings and buffers") {
val original = Buffer.from("This is a compression example")

for {
Expand Down

0 comments on commit bcccb5c

Please sign in to comment.