@@ -97,49 +97,36 @@ class Buffer private[this] () extends Uint8Array( /* dummy to trick constructor
97
97
*/
98
98
def equals (otherBuffer : Uint8Array ): Boolean = js.native
99
99
100
- /**
101
- * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled.
102
- * This is meant to be a small simplification to allow the creation and filling of a Buffer to be done on a single line.
103
- *
104
- * @param value The value to fill buf with
105
- * @param offset Where to start filling buf. Default: 0
106
- * @param end Where to stop filling buf (not inclusive). Default: buf.length
107
- * @param encoding If value is a string, this is its encoding. Default: 'utf8'
108
- * @return A reference to buf
109
- * @see https://nodejs.org/api/buffer.html#buffer_buf_fill_value_offset_end_encoding
110
- */
111
- def fill (value : Uint8Array | Int | String , offset : Int , end : Int , encoding : String ): this .type = js.native
112
- def fill (value : Uint8Array | Int | String , offset : Int , end : Int ): this .type = js.native
113
- def fill (value : Uint8Array | Int | String , offset : Int , encoding : String ): this .type = js.native
114
- def fill (value : Uint8Array | Int | String , offset : Int ): this .type = js.native
115
- def fill (value : Uint8Array | Int | String , encoding : String ): this .type = js.native
116
- def fill (value : Uint8Array | Int | String ): this .type = js.native
117
-
118
- /**
119
- * Returns the index of the first occurrence of value in buf or -1 if buf does not contain value
120
- * @param value What to search for
121
- * @param byteOffset Where to begin searching in buf. Default: 0
122
- * @param encoding If value is a string, this is its encoding. Default: 'utf8'
123
- * @return The index of the first occurrence of value in buf or -1 if buf does not contain value
124
- * @example {{{ buf.indexOf(value[, byteOffset][, encoding]) }}}
125
- */
126
- def indexOf (value : Buffer | Int | String , byteOffset : Int , encoding : String ): Int = js.native
127
- def indexOf (value : Buffer | Int | String , byteOffset : Int ): Int = js.native
128
- def indexOf (value : Buffer | Int | String , encoding : String ): Int = js.native
129
- def indexOf (value : Buffer | Int | String ): Int = js.native
130
-
131
- /**
132
- * Equivalent to buf.indexOf() !== -1.
133
- * @param value What to search for
134
- * @param byteOffset Where to begin searching in buf. Default: 0
135
- * @param encoding If value is a string, this is its encoding. Default: 'utf8'
136
- * @return true if value was found in buf, false otherwise
137
- * @example {{{ buf.includes(value[, byteOffset][, encoding]) }}}
138
- */
139
- def includes (value : Buffer | Int | String , byteOffset : Int , encoding : String ): Boolean = js.native
140
- def includes (value : Buffer | Int | String , byteOffset : Int ): Boolean = js.native
141
- def includes (value : Buffer | Int | String , encoding : String ): Boolean = js.native
142
- def includes (value : Buffer | Int | String ): Boolean = js.native
100
+ def fill (value : Uint8Array , offset : Int , end : Int ): this .type = js.native
101
+ def fill (value : Uint8Array , offset : Int ): this .type = js.native
102
+ def fill (value : Uint8Array ): this .type = js.native
103
+ def fill (value : Int , offset : Int , end : Int ): this .type = js.native
104
+ def fill (value : Int , offset : Int ): this .type = js.native
105
+ def fill (value : Int ): this .type = js.native
106
+ def fill (value : String , offset : Int , end : Int , encoding : String ): this .type = js.native
107
+ def fill (value : String , offset : Int , end : Int ): this .type = js.native
108
+ def fill (value : String , offset : Int , encoding : String ): this .type = js.native
109
+ def fill (value : String , offset : Int ): this .type = js.native
110
+ def fill (value : String , encoding : String ): this .type = js.native
111
+ def fill (value : String ): this .type = js.native
112
+
113
+ def indexOf (value : Buffer , byteOffset : Int ): Int = js.native
114
+ def indexOf (value : Buffer ): Int = js.native
115
+ def indexOf (value : Int , byteOffset : Int ): Int = js.native
116
+ def indexOf (value : Int ): Int = js.native
117
+ def indexOf (value : String , byteOffset : Int , encoding : String ): Int = js.native
118
+ def indexOf (value : String , byteOffset : Int ): Int = js.native
119
+ def indexOf (value : String , encoding : String ): Int = js.native
120
+ def indexOf (value : String ): Int = js.native
121
+
122
+ def includes (value : Buffer , byteOffset : Int ): Boolean = js.native
123
+ def includes (value : Buffer ): Boolean = js.native
124
+ def includes (value : Int , byteOffset : Int ): Boolean = js.native
125
+ def includes (value : Int ): Boolean = js.native
126
+ def includes (value : String , byteOffset : Int , encoding : String ): Boolean = js.native
127
+ def includes (value : String , byteOffset : Int ): Boolean = js.native
128
+ def includes (value : String , encoding : String ): Boolean = js.native
129
+ def includes (value : String ): Boolean = js.native
143
130
144
131
/**
145
132
* Creates and returns an iterator of buf keys (indices).
@@ -148,18 +135,14 @@ class Buffer private[this] () extends Uint8Array( /* dummy to trick constructor
148
135
*/
149
136
def keys (): js.Iterator [Int ] = js.native
150
137
151
- /**
152
- * Identical to buf.indexOf(), except buf is searched from back to front instead of front to back.
153
- * @param value What to search for
154
- * @param byteOffset Where to begin searching in buf. Default: 0
155
- * @param encoding If value is a string, this is its encoding. Default: 'utf8'
156
- * @return The index of the last occurrence of value in buf or -1 if buf does not contain value
157
- * @example {{{ buf.lastIndexOf(value[, byteOffset][, encoding]) }}}
158
- */
159
- def lastIndexOf (value : Buffer | Int | String , byteOffset : Int , encoding : String ): Int = js.native
160
- def lastIndexOf (value : Buffer | Int | String , byteOffset : Int ): Int = js.native
161
- def lastIndexOf (value : Buffer | Int | String , encoding : String ): Int = js.native
162
- def lastIndexOf (value : Buffer | Int | String ): Int = js.native
138
+ def lastIndexOf (value : Buffer , byteOffset : Int ): Int = js.native
139
+ def lastIndexOf (value : Buffer ): Int = js.native
140
+ def lastIndexOf (value : Int , byteOffset : Int ): Int = js.native
141
+ def lastIndexOf (value : Int ): Int = js.native
142
+ def lastIndexOf (value : String , byteOffset : Int , encoding : String ): Int = js.native
143
+ def lastIndexOf (value : String , byteOffset : Int ): Int = js.native
144
+ def lastIndexOf (value : String , encoding : String ): Int = js.native
145
+ def lastIndexOf (value : String ): Int = js.native
163
146
164
147
/**
165
148
* Returns the amount of memory allocated for buf in bytes.
@@ -925,8 +908,11 @@ object Buffer extends js.Object {
925
908
*
926
909
* @see [[https://nodejs.org/api/buffer.html#buffer_class_method_buffer_bytelength_string_encoding ]]
927
910
*/
928
- def byteLength (string : String | TypedArray [_, _] | DataView | ArrayBuffer , encoding : String = " utf8" ): Int =
929
- js.native
911
+ def byteLength (string : String , encoding : String ): Int = js.native
912
+ def byteLength (string : String ): Int = js.native
913
+ def byteLength (string : TypedArray [_, _]): Int = js.native
914
+ def byteLength (string : DataView ): Int = js.native
915
+ def byteLength (string : ArrayBuffer ): Int = js.native
930
916
931
917
/**
932
918
* Compares `buf1` to `buf2` typically for the purpose of sorting arrays of `Buffer` instances.
@@ -945,8 +931,8 @@ object Buffer extends js.Object {
945
931
* @see [[https://nodejs.org/api/buffer.html#buffer_class_method_buffer_concat_list_totallength ]]
946
932
*
947
933
*/
948
- def concat (list : js.Array [Buffer ] | js. Array [ Uint8Array ], totalLength : Int ): Buffer = js.native
949
- def concat (list : js.Array [Buffer ] | js. Array [ Uint8Array ]): Buffer = js.native
934
+ def concat [ B <: Uint8Array ] (list : js.Array [B ], totalLength : Int ): Buffer = js.native
935
+ def concat [ B <: Uint8Array ] (list : js.Array [B ]): Buffer = js.native
950
936
951
937
/**
952
938
* When passed a reference to the .buffer property of a TypedArray instance, the newly created Buffer
0 commit comments