forked from scalajs-io/nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
ab2a7f0
commit a05f674
Showing
20 changed files
with
229 additions
and
180 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package io.scalajs.nodejs.crypto | ||
|
||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream.Duplex | ||
import io.scalajs.nodejs.stream.IDuplex | ||
|
||
import scala.scalajs.js | ||
|
||
|
@@ -17,7 +17,7 @@ import scala.scalajs.js | |
* @author [email protected] | ||
*/ | ||
@js.native | ||
trait Cipher extends Duplex { | ||
trait Cipher extends IDuplex { | ||
|
||
/** | ||
* Returns any remaining enciphered contents. If output_encoding parameter is one of 'binary', 'base64' or 'hex', | ||
|
@@ -27,7 +27,7 @@ trait Cipher extends Duplex { | |
* Attempts to call cipher.final() more than once will result in an error being thrown. | ||
* @example cipher.final([output_encoding]) | ||
*/ | ||
def `final`(output_encoding: String ): String = js.native | ||
def `final`(output_encoding: String): String = js.native | ||
|
||
/** | ||
* Returns any remaining enciphered contents. If output_encoding parameter is one of 'binary', 'base64' or 'hex', | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package io.scalajs.nodejs.crypto | ||
|
||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream.Duplex | ||
import io.scalajs.nodejs.stream.IDuplex | ||
|
||
import scala.scalajs.js | ||
|
||
|
@@ -17,7 +17,7 @@ import scala.scalajs.js | |
* @author [email protected] | ||
*/ | ||
@js.native | ||
trait Decipher extends Duplex { | ||
trait Decipher extends IDuplex { | ||
|
||
/** | ||
* Returns any remaining deciphered contents. If output_encoding parameter is one of 'binary', 'base64' or 'hex', | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package io.scalajs.nodejs.crypto | ||
|
||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream.Duplex | ||
import io.scalajs.nodejs.stream.IDuplex | ||
|
||
import scala.scalajs.js | ||
|
||
|
@@ -16,7 +16,7 @@ import scala.scalajs.js | |
* @author [email protected] | ||
*/ | ||
@js.native | ||
trait Hash extends Duplex { | ||
trait Hash extends IDuplex { | ||
|
||
/** | ||
* Calculates the digest of all of the data passed to be hashed (using the hash.update() method). The encoding can | ||
|
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package io.scalajs.nodejs.crypto | ||
|
||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream.Duplex | ||
import io.scalajs.nodejs.stream.IDuplex | ||
|
||
import scala.scalajs.js | ||
|
||
|
@@ -17,7 +17,7 @@ import scala.scalajs.js | |
* @author [email protected] | ||
*/ | ||
@js.native | ||
trait Hmac extends Duplex { | ||
trait Hmac extends IDuplex { | ||
|
||
/** | ||
* Calculates the HMAC digest of all of the data passed using hmac.update(). The encoding can be 'hex', 'binary' | ||
|
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
package io.scalajs.nodejs.crypto | ||
|
||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream | ||
import io.scalajs.nodejs.stream.Duplex | ||
import io.scalajs.nodejs.stream.IDuplex | ||
|
||
import scala.scalajs.js | ||
|
||
|
@@ -18,7 +17,7 @@ import scala.scalajs.js | |
* @author [email protected] | ||
*/ | ||
@js.native | ||
trait Sign extends Duplex { | ||
trait Sign extends IDuplex { | ||
|
||
def sign(private_key: String): String = js.native | ||
|
||
|
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
package io.scalajs.nodejs.crypto | ||
|
||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream | ||
import io.scalajs.nodejs.stream.Duplex | ||
import io.scalajs.nodejs.stream.IDuplex | ||
|
||
import scala.scalajs.js | ||
|
||
|
@@ -17,7 +16,7 @@ import scala.scalajs.js | |
* @author [email protected] | ||
*/ | ||
@js.native | ||
trait Verify extends Duplex { | ||
trait Verify extends IDuplex { | ||
|
||
/** | ||
* Updates the Verify content with the given data. | ||
|
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
package io.scalajs.nodejs.fs | ||
|
||
import io.scalajs.nodejs.FileDescriptor | ||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream.Readable | ||
import io.scalajs.util.PromiseHelper.promiseCallback1 | ||
|
||
import scala.concurrent.Promise | ||
import scala.scalajs.js | ||
import scala.scalajs.js.| | ||
|
||
/** | ||
* fs.ReadStream - ReadStream is a Readable Stream. | ||
|
@@ -12,12 +16,31 @@ import scala.scalajs.js | |
@js.native | ||
trait ReadStream extends Readable { | ||
|
||
///////////////////////////////////////////////////////////////////////////////// | ||
// Properties | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* The number of bytes read so far. | ||
*/ | ||
def bytesRead: Double = js.native | ||
|
||
/** | ||
* The path to the file the stream is reading from as specified in the first argument to fs.createReadStream(). | ||
* If path is passed as a string, then readStream.path will be a string. If path is passed as a Buffer, then | ||
* readStream.path will be a Buffer. | ||
*/ | ||
def path: js.Any = js.native | ||
def path: Buffer | String = js.native | ||
|
||
///////////////////////////////////////////////////////////////////////////////// | ||
// Methods | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* Undocumented method | ||
* @see https://github.com/nodejs/node-v0.x-archive/blob/cfcb1de130867197cbc9c6012b7e84e08e53d032/lib/fs.js#L1597-L1620 | ||
*/ | ||
def close[A](callback: js.Function1[Unit, A]): Unit = js.native | ||
|
||
} | ||
|
||
|
@@ -33,13 +56,24 @@ object ReadStream { | |
*/ | ||
implicit class ReadStreamExtensions(val stream: ReadStream) extends AnyVal { | ||
|
||
@inline | ||
def closeAsync: Promise[Unit] = promiseCallback1[Unit](stream.close) | ||
|
||
} | ||
|
||
/** | ||
* Read Stream Events | ||
* @author [email protected] | ||
*/ | ||
implicit class ReadStreamEvents(val stream: ReadStream) extends AnyVal { | ||
|
||
/** | ||
* Emitted when the ReadStream's underlying file descriptor has been closed using the fs.close() method. | ||
* @param listener the event handler | ||
* @since 0.1.93 | ||
*/ | ||
@inline | ||
def onClose(listener: () => Any): stream.type = stream.on("close", listener) | ||
def onClose[A](listener: () => A): stream.type = stream.on("close", listener) | ||
|
||
/** | ||
* Emitted when the ReadStream's file is opened. | ||
|
@@ -50,7 +84,7 @@ object ReadStream { | |
* @since 0.1.93 | ||
*/ | ||
@inline | ||
def onOpen(listener: FileDescriptor => Any): stream.type = stream.on("open", listener) | ||
def onOpen[A](listener: FileDescriptor => A): stream.type = stream.on("open", listener) | ||
|
||
} | ||
|
||
|
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 |
---|---|---|
@@ -1,9 +1,13 @@ | ||
package io.scalajs.nodejs.fs | ||
|
||
import io.scalajs.util.PromiseHelper._ | ||
import io.scalajs.nodejs.FileDescriptor | ||
import io.scalajs.nodejs.buffer.Buffer | ||
import io.scalajs.nodejs.stream.Writable | ||
|
||
import scala.concurrent.Promise | ||
import scala.scalajs.js | ||
import scala.scalajs.js.| | ||
|
||
/** | ||
* fs.WriteStream - WriteStream is a Writable Stream. | ||
|
@@ -12,6 +16,10 @@ import scala.scalajs.js | |
@js.native | ||
trait WriteStream extends Writable { | ||
|
||
///////////////////////////////////////////////////////////////////////////////// | ||
// Properties | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* The number of bytes written so far. Does not include data that is still queued for writing. | ||
*/ | ||
|
@@ -22,7 +30,17 @@ trait WriteStream extends Writable { | |
* If path is passed as a string, then writeStream.path will be a string. If path is passed as a Buffer, then | ||
* writeStream.path will be a Buffer. | ||
*/ | ||
def path: js.Any = js.native | ||
def path: Buffer | String = js.native | ||
|
||
///////////////////////////////////////////////////////////////////////////////// | ||
// Methods | ||
///////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* Undocumented method | ||
* @see https://github.com/nodejs/node-v0.x-archive/blob/cfcb1de130867197cbc9c6012b7e84e08e53d032/lib/fs.js#L1597-L1620 | ||
*/ | ||
def close[A](callback: js.Function1[Unit, A]): Unit = js.native | ||
|
||
} | ||
|
||
|
@@ -38,12 +56,24 @@ object WriteStream { | |
*/ | ||
implicit class WriteStreamExtensions(val stream: WriteStream) extends AnyVal { | ||
|
||
@inline | ||
def closeAsync: Promise[Unit] = promiseCallback1[Unit](stream.close) | ||
|
||
} | ||
|
||
/** | ||
* Write Stream Events | ||
* @author [email protected] | ||
*/ | ||
implicit class WriteStreamEvents(val stream: WriteStream) extends AnyVal { | ||
|
||
/** | ||
* Emitted when the WriteStream's underlying file descriptor has been closed using the fs.close() method. | ||
* @param listener the event handler | ||
* @since 0.1.93 | ||
*/ | ||
@inline def onClose(listener: () => Any) = stream.on("close", listener) | ||
@inline | ||
def onClose[A](listener: () => A): stream.type = stream.on("close", listener) | ||
|
||
/** | ||
* Emitted when the WriteStream's file is opened. | ||
|
@@ -53,7 +83,8 @@ object WriteStream { | |
* </ul> | ||
* @since 0.1.93 | ||
*/ | ||
@inline def onOpen(listener: FileDescriptor => Any) = stream.on("open", listener) | ||
@inline | ||
def onOpen[A](listener: FileDescriptor => A): stream.type = stream.on("open", listener) | ||
|
||
} | ||
|
||
|
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
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.