bare-buffer 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js
CHANGED
|
@@ -225,6 +225,24 @@ const Buffer = module.exports = exports = class Buffer extends Uint8Array {
|
|
|
225
225
|
return codecFor(encoding).write(buffer, string)
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
+
writeUInt8 (value, offset = 0) {
|
|
229
|
+
const view = new DataView(this.buffer, this.byteoffset, this.bytelength)
|
|
230
|
+
view.setUint8(offset, value, true)
|
|
231
|
+
|
|
232
|
+
return offset + 1
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
writeUint8 (...args) {
|
|
236
|
+
return this.writeUInt8(...args)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
writeInt8 (value, offset = 0) {
|
|
240
|
+
const view = new DataView(this.buffer, this.byteoffset, this.bytelength)
|
|
241
|
+
view.setInt8(offset, value)
|
|
242
|
+
|
|
243
|
+
return offset + 1
|
|
244
|
+
}
|
|
245
|
+
|
|
228
246
|
writeDoubleLE (value, offset = 0) {
|
|
229
247
|
const view = new DataView(this.buffer, this.byteOffset, this.byteLength)
|
|
230
248
|
view.setFloat64(offset, value, true)
|
|
@@ -260,6 +278,22 @@ const Buffer = module.exports = exports = class Buffer extends Uint8Array {
|
|
|
260
278
|
return offset + 4
|
|
261
279
|
}
|
|
262
280
|
|
|
281
|
+
readInt8 (offset = 0) {
|
|
282
|
+
const view = new DataView(this.buffer, this.byteOffset, this.byteLength)
|
|
283
|
+
|
|
284
|
+
return view.getInt8(offset)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
readUInt8 (offset = 0) {
|
|
288
|
+
const view = new DataView(this.buffer, this.byteOffset, this.byteLength)
|
|
289
|
+
|
|
290
|
+
return view.getUint8(offset)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
readUint8 (...args) {
|
|
294
|
+
return this.readUInt8(...args)
|
|
295
|
+
}
|
|
296
|
+
|
|
263
297
|
readDoubleLE (offset = 0) {
|
|
264
298
|
const view = new DataView(this.buffer, this.byteOffset, this.byteLength)
|
|
265
299
|
|
package/package.json
CHANGED
|
Binary file
|
|
File without changes
|
|
Binary file
|