Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 27d3aff

Browse files
authored
Merge pull request #67 from exoego/string-decoder
Overhaul string-decoder module
2 parents 7893d49 + 7c605f9 commit 27d3aff

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The following core Node.js modules (v8.7.0+) have been implemented:
4141
| [readline](https://nodejs.org/api/readline.html) | |
4242
| [repl](https://nodejs.org/api/repl.html) | |
4343
| [stream](https://nodejs.org/api/stream.html) | |
44-
| [string-decoder](https://nodejs.org/api/string_decoder.html) | |
44+
| [string-decoder](https://nodejs.org/api/string_decoder.html) | :heavy_check_mark: |
4545
| [timers](https://nodejs.org/api/timers.html) | :heavy_check_mark: |
4646
| [tty](https://nodejs.org/api/tty.html) | |
4747
| [url](https://nodejs.org/api/url.html) | :heavy_check_mark: |
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package io.scalajs.nodejs
22

3-
import io.scalajs.nodejs.buffer.Buffer
43
import io.scalajs.nodejs.events.IEventEmitter
54

65
import scala.scalajs.js
76
import scala.scalajs.js.annotation.JSImport
7+
import scala.scalajs.js.typedarray.{DataView, TypedArray}
8+
import scala.scalajs.js.|
89

910
/**
1011
* To use this module, do require('string_decoder'). StringDecoder decodes a buffer to a string. It is a simple
11-
* interface to [[Buffer.toString()]] but provides additional support for utf8.
12+
* interface to Buffer.toString() but provides additional support for utf8.
1213
*/
1314
@js.native
1415
@JSImport("string_decoder", "StringDecoder")
@@ -18,12 +19,12 @@ class StringDecoder(encoding: String = js.native) extends IEventEmitter {
1819
* Returns any trailing bytes that were left in the buffer.
1920
* @example decoder.end()
2021
*/
21-
def end(buffer: Buffer = js.native): String = js.native
22+
def end(buffer: TypedArray[_, _] | DataView = js.native): String = js.native
2223

2324
/**
2425
* Returns a decoded string.
2526
* @example decoder.write(buffer)
2627
*/
27-
def write(buffer: Buffer): String = js.native
28+
def write(buffer: TypedArray[_, _] | DataView): String = js.native
2829

2930
}

0 commit comments

Comments
 (0)