@grain/stdlib 0.7.0 → 0.7.1
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/CHANGELOG.md +10 -0
- package/array.md +491 -491
- package/bigint.md +198 -198
- package/buffer.gr +66 -1
- package/buffer.md +395 -272
- package/bytes.gr +1 -0
- package/bytes.md +200 -199
- package/char.md +125 -125
- package/exception.md +9 -9
- package/float32.md +195 -195
- package/float64.md +195 -195
- package/fs.md +115 -115
- package/hash.md +16 -16
- package/int16.md +155 -155
- package/int32.gr +1 -1
- package/int32.md +207 -207
- package/int64.gr +1 -1
- package/int64.md +207 -207
- package/int8.md +155 -155
- package/json.md +59 -59
- package/list.md +347 -347
- package/map.md +222 -222
- package/marshal.md +12 -12
- package/number.gr +119 -5
- package/number.md +503 -261
- package/option.md +141 -141
- package/package.json +1 -1
- package/path.md +90 -90
- package/pervasives.md +238 -238
- package/priorityqueue.md +112 -112
- package/queue.md +117 -117
- package/random.md +37 -37
- package/range.md +36 -36
- package/rational.md +107 -107
- package/regex.md +91 -91
- package/result.md +102 -102
- package/runtime/atof/decimal.md +6 -6
- package/runtime/compare.md +7 -7
- package/runtime/dataStructures.md +178 -178
- package/runtime/equal.md +7 -7
- package/runtime/exception.md +15 -15
- package/runtime/malloc.md +9 -9
- package/runtime/numbers.md +269 -269
- package/runtime/string.md +17 -17
- package/runtime/unsafe/conv.md +6 -6
- package/runtime/unsafe/memory.md +10 -10
- package/runtime/utf8.md +31 -31
- package/runtime/wasi.md +9 -9
- package/set.md +211 -211
- package/stack.md +122 -122
- package/string.md +228 -228
- package/uint16.md +148 -148
- package/uint32.md +192 -192
- package/uint64.md +192 -192
- package/uint8.md +148 -148
- package/uri.md +77 -77
- package/wasi/file.md +269 -269
- package/wasi/process.md +21 -21
- package/wasi/random.md +9 -9
- package/wasi/time.md +12 -12
package/buffer.md
CHANGED
|
@@ -51,15 +51,15 @@ That byte sequence is automatically reallocated when more than `initialSize` byt
|
|
|
51
51
|
|
|
52
52
|
Parameters:
|
|
53
53
|
|
|
54
|
-
|param|type|description|
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
| param | type | description |
|
|
55
|
+
| ------------- | -------- | ------------------------------ |
|
|
56
|
+
| `initialSize` | `Number` | The initial size of the buffer |
|
|
57
57
|
|
|
58
58
|
Returns:
|
|
59
59
|
|
|
60
|
-
|type|description|
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
| type | description |
|
|
61
|
+
| -------- | -------------- |
|
|
62
|
+
| `Buffer` | The new buffer |
|
|
63
63
|
|
|
64
64
|
Throws:
|
|
65
65
|
|
|
@@ -92,15 +92,15 @@ Gets the number of bytes currently contained in a buffer.
|
|
|
92
92
|
|
|
93
93
|
Parameters:
|
|
94
94
|
|
|
95
|
-
|param|type|description|
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
| param | type | description |
|
|
96
|
+
| -------- | -------- | -------------------- |
|
|
97
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
98
98
|
|
|
99
99
|
Returns:
|
|
100
100
|
|
|
101
|
-
|type|description|
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
| type | description |
|
|
102
|
+
| -------- | --------------------------------- |
|
|
103
|
+
| `Number` | The length of the buffer in bytes |
|
|
104
104
|
|
|
105
105
|
Examples:
|
|
106
106
|
|
|
@@ -131,9 +131,9 @@ This operation does not resize the underlying byte sequence.
|
|
|
131
131
|
|
|
132
132
|
Parameters:
|
|
133
133
|
|
|
134
|
-
|param|type|description|
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
| param | type | description |
|
|
135
|
+
| -------- | -------- | ------------------- |
|
|
136
|
+
| `buffer` | `Buffer` | The buffer to clear |
|
|
137
137
|
|
|
138
138
|
Examples:
|
|
139
139
|
|
|
@@ -162,9 +162,9 @@ This operation resizes the underlying byte sequence to the initial size of the b
|
|
|
162
162
|
|
|
163
163
|
Parameters:
|
|
164
164
|
|
|
165
|
-
|param|type|description|
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
| param | type | description |
|
|
166
|
+
| -------- | -------- | ------------------- |
|
|
167
|
+
| `buffer` | `Buffer` | The buffer to reset |
|
|
168
168
|
|
|
169
169
|
Examples:
|
|
170
170
|
|
|
@@ -193,10 +193,10 @@ This operation does not resize the underlying byte sequence.
|
|
|
193
193
|
|
|
194
194
|
Parameters:
|
|
195
195
|
|
|
196
|
-
|param|type|description|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
| param | type | description |
|
|
197
|
+
| -------- | -------- | --------------------------------------------- |
|
|
198
|
+
| `length` | `Number` | The number of bytes to truncate the buffer to |
|
|
199
|
+
| `buffer` | `Buffer` | The buffer to truncate |
|
|
200
200
|
|
|
201
201
|
Throws:
|
|
202
202
|
|
|
@@ -230,15 +230,15 @@ Returns a copy of the current contents of the buffer as a byte sequence.
|
|
|
230
230
|
|
|
231
231
|
Parameters:
|
|
232
232
|
|
|
233
|
-
|param|type|description|
|
|
234
|
-
|
|
235
|
-
|
|
233
|
+
| param | type | description |
|
|
234
|
+
| -------- | -------- | --------------------------------------- |
|
|
235
|
+
| `buffer` | `Buffer` | The buffer to copy into a byte sequence |
|
|
236
236
|
|
|
237
237
|
Returns:
|
|
238
238
|
|
|
239
|
-
|type|description|
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
| type | description |
|
|
240
|
+
| ------- | -------------------------------------------- |
|
|
241
|
+
| `Bytes` | A byte sequence made from copied buffer data |
|
|
242
242
|
|
|
243
243
|
Examples:
|
|
244
244
|
|
|
@@ -263,17 +263,17 @@ Returns a slice of the current contents of the buffer as a byte sequence.
|
|
|
263
263
|
|
|
264
264
|
Parameters:
|
|
265
265
|
|
|
266
|
-
|param|type|description|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
266
|
+
| param | type | description |
|
|
267
|
+
| -------- | -------- | ------------------------------------------------------- |
|
|
268
|
+
| `start` | `Number` | The start index |
|
|
269
|
+
| `length` | `Number` | The number of bytes to include after the starting index |
|
|
270
|
+
| `buffer` | `Buffer` | The buffer to copy from |
|
|
271
271
|
|
|
272
272
|
Returns:
|
|
273
273
|
|
|
274
|
-
|type|description|
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
| type | description |
|
|
275
|
+
| ------- | ------------------------------------------------- |
|
|
276
|
+
| `Bytes` | A byte sequence with bytes copied from the buffer |
|
|
277
277
|
|
|
278
278
|
Throws:
|
|
279
279
|
|
|
@@ -306,15 +306,15 @@ Returns a copy of the current contents of the buffer as a string.
|
|
|
306
306
|
|
|
307
307
|
Parameters:
|
|
308
308
|
|
|
309
|
-
|param|type|description|
|
|
310
|
-
|
|
311
|
-
|
|
309
|
+
| param | type | description |
|
|
310
|
+
| -------- | -------- | ----------------------- |
|
|
311
|
+
| `buffer` | `Buffer` | The buffer to stringify |
|
|
312
312
|
|
|
313
313
|
Returns:
|
|
314
314
|
|
|
315
|
-
|type|description|
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
| type | description |
|
|
316
|
+
| -------- | ---------------------------------------------- |
|
|
317
|
+
| `String` | A string made with data copied from the buffer |
|
|
318
318
|
|
|
319
319
|
Examples:
|
|
320
320
|
|
|
@@ -339,17 +339,17 @@ Returns a copy of a subset of the current contents of the buffer as a string.
|
|
|
339
339
|
|
|
340
340
|
Parameters:
|
|
341
341
|
|
|
342
|
-
|param|type|description|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
342
|
+
| param | type | description |
|
|
343
|
+
| -------- | -------- | ------------------------------------------------------- |
|
|
344
|
+
| `start` | `Number` | The start index |
|
|
345
|
+
| `length` | `Number` | The number of bytes to include after the starting index |
|
|
346
|
+
| `buffer` | `Buffer` | The buffer to copy from |
|
|
347
347
|
|
|
348
348
|
Returns:
|
|
349
349
|
|
|
350
|
-
|type|description|
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
| type | description |
|
|
351
|
+
| -------- | ---------------------------------------------------------- |
|
|
352
|
+
| `String` | A string made with a subset of data copied from the buffer |
|
|
353
353
|
|
|
354
354
|
Examples:
|
|
355
355
|
|
|
@@ -374,10 +374,10 @@ Appends a byte sequence to a buffer.
|
|
|
374
374
|
|
|
375
375
|
Parameters:
|
|
376
376
|
|
|
377
|
-
|param|type|description|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
377
|
+
| param | type | description |
|
|
378
|
+
| -------- | -------- | --------------------------- |
|
|
379
|
+
| `bytes` | `Bytes` | The byte sequence to append |
|
|
380
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
381
381
|
|
|
382
382
|
Examples:
|
|
383
383
|
|
|
@@ -402,10 +402,10 @@ Appends the bytes of a string to a buffer.
|
|
|
402
402
|
|
|
403
403
|
Parameters:
|
|
404
404
|
|
|
405
|
-
|param|type|description|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
405
|
+
| param | type | description |
|
|
406
|
+
| -------- | -------- | -------------------- |
|
|
407
|
+
| `string` | `String` | The string to append |
|
|
408
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
409
409
|
|
|
410
410
|
Examples:
|
|
411
411
|
|
|
@@ -415,6 +415,51 @@ Buffer.addString("Hello", buf)
|
|
|
415
415
|
assert Buffer.toString(buf) == "Hello"
|
|
416
416
|
```
|
|
417
417
|
|
|
418
|
+
### Buffer.**getChar**
|
|
419
|
+
|
|
420
|
+
<details disabled>
|
|
421
|
+
<summary tabindex="-1">Added in <code>0.7.1</code></summary>
|
|
422
|
+
No other changes yet.
|
|
423
|
+
</details>
|
|
424
|
+
|
|
425
|
+
```grain
|
|
426
|
+
getChar: (index: Number, buffer: Buffer) => Char
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Gets the UTF-8 encoded character at the given byte index.
|
|
430
|
+
|
|
431
|
+
Parameters:
|
|
432
|
+
|
|
433
|
+
| param | type | description |
|
|
434
|
+
| -------- | -------- | ------------------------ |
|
|
435
|
+
| `index` | `Number` | The byte index to access |
|
|
436
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
437
|
+
|
|
438
|
+
Returns:
|
|
439
|
+
|
|
440
|
+
| type | description |
|
|
441
|
+
| ------ | --------------------------------------- |
|
|
442
|
+
| `Char` | A character starting at the given index |
|
|
443
|
+
|
|
444
|
+
Throws:
|
|
445
|
+
|
|
446
|
+
`IndexOutOfBounds`
|
|
447
|
+
|
|
448
|
+
* When `index` is negative
|
|
449
|
+
* When `index + 1` is greater than the buffer size
|
|
450
|
+
|
|
451
|
+
`MalformedUnicode`
|
|
452
|
+
|
|
453
|
+
* When the bytes at the index are not a valid UTF-8 sequence
|
|
454
|
+
|
|
455
|
+
Examples:
|
|
456
|
+
|
|
457
|
+
```grain
|
|
458
|
+
let buf = Buffer.make(32)
|
|
459
|
+
Buffer.addString("Hello World 🌾", buf)
|
|
460
|
+
assert Buffer.getChar(12, buf) == '🌾'
|
|
461
|
+
```
|
|
462
|
+
|
|
418
463
|
### Buffer.**addChar**
|
|
419
464
|
|
|
420
465
|
<details disabled>
|
|
@@ -430,10 +475,10 @@ Appends the bytes of a character to a buffer.
|
|
|
430
475
|
|
|
431
476
|
Parameters:
|
|
432
477
|
|
|
433
|
-
|param|type|description|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
478
|
+
| param | type | description |
|
|
479
|
+
| -------- | -------- | ------------------------------------- |
|
|
480
|
+
| `char` | `Char` | The character to append to the buffer |
|
|
481
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
437
482
|
|
|
438
483
|
Examples:
|
|
439
484
|
|
|
@@ -458,10 +503,10 @@ Appends a character represented by a code point to a buffer.
|
|
|
458
503
|
|
|
459
504
|
Parameters:
|
|
460
505
|
|
|
461
|
-
|param|type|description|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
506
|
+
| param | type | description |
|
|
507
|
+
| ----------- | -------- | -------------------------------------- |
|
|
508
|
+
| `codePoint` | `Number` | The code point to append to the buffer |
|
|
509
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
465
510
|
|
|
466
511
|
Examples:
|
|
467
512
|
|
|
@@ -494,12 +539,12 @@ Appends the bytes of a subset of a string to a buffer.
|
|
|
494
539
|
|
|
495
540
|
Parameters:
|
|
496
541
|
|
|
497
|
-
|param|type|description|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
542
|
+
| param | type | description |
|
|
543
|
+
| -------- | -------- | ------------------------------- |
|
|
544
|
+
| `start` | `Number` | The char offset into the string |
|
|
545
|
+
| `end` | `Number` | The end offset into the string |
|
|
546
|
+
| `string` | `String` | The string to append |
|
|
547
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
503
548
|
|
|
504
549
|
Examples:
|
|
505
550
|
|
|
@@ -525,12 +570,12 @@ Appends the bytes of a subset of a byte sequence to a buffer.
|
|
|
525
570
|
|
|
526
571
|
Parameters:
|
|
527
572
|
|
|
528
|
-
|param|type|description|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
573
|
+
| param | type | description |
|
|
574
|
+
| -------- | -------- | -------------------------------------- |
|
|
575
|
+
| `start` | `Number` | The byte offset into the byte sequence |
|
|
576
|
+
| `length` | `Number` | The number of bytes to append |
|
|
577
|
+
| `bytes` | `Bytes` | The byte sequence to append |
|
|
578
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
534
579
|
|
|
535
580
|
Throws:
|
|
536
581
|
|
|
@@ -566,10 +611,10 @@ The source buffer is not mutated by this operation. The destination buffer, howe
|
|
|
566
611
|
|
|
567
612
|
Parameters:
|
|
568
613
|
|
|
569
|
-
|param|type|description|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
614
|
+
| param | type | description |
|
|
615
|
+
| ----------- | -------- | -------------------- |
|
|
616
|
+
| `srcBuffer` | `Buffer` | The buffer to append |
|
|
617
|
+
| `dstBuffer` | `Buffer` | The buffer to mutate |
|
|
573
618
|
|
|
574
619
|
Examples:
|
|
575
620
|
|
|
@@ -601,12 +646,12 @@ The source buffer is not mutated by this operation. The destination buffer, howe
|
|
|
601
646
|
|
|
602
647
|
Parameters:
|
|
603
648
|
|
|
604
|
-
|param|type|description|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
649
|
+
| param | type | description |
|
|
650
|
+
| ----------- | -------- | ------------------------------- |
|
|
651
|
+
| `start` | `Number` | The byte offset into the buffer |
|
|
652
|
+
| `length` | `Number` | The number of bytes to append |
|
|
653
|
+
| `srcBuffer` | `Buffer` | The buffer to append |
|
|
654
|
+
| `dstBuffer` | `Buffer` | The buffer to mutate |
|
|
610
655
|
|
|
611
656
|
Examples:
|
|
612
657
|
|
|
@@ -641,16 +686,16 @@ Gets a signed 8-bit integer starting at the given byte index.
|
|
|
641
686
|
|
|
642
687
|
Parameters:
|
|
643
688
|
|
|
644
|
-
|param|type|description|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
689
|
+
| param | type | description |
|
|
690
|
+
| -------- | -------- | ------------------------ |
|
|
691
|
+
| `index` | `Number` | The byte index to access |
|
|
692
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
648
693
|
|
|
649
694
|
Returns:
|
|
650
695
|
|
|
651
|
-
|type|description|
|
|
652
|
-
|
|
653
|
-
|
|
696
|
+
| type | description |
|
|
697
|
+
| ------ | ----------------------------------------------------- |
|
|
698
|
+
| `Int8` | A signed 8-bit integer that starts at the given index |
|
|
654
699
|
|
|
655
700
|
Throws:
|
|
656
701
|
|
|
@@ -670,6 +715,8 @@ assert Buffer.getInt8(0, buf) == 1s
|
|
|
670
715
|
|
|
671
716
|
### Buffer.**setInt8**
|
|
672
717
|
|
|
718
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
719
|
+
|
|
673
720
|
<details>
|
|
674
721
|
<summary>Added in <code>0.4.0</code></summary>
|
|
675
722
|
<table>
|
|
@@ -678,6 +725,7 @@ assert Buffer.getInt8(0, buf) == 1s
|
|
|
678
725
|
</thead>
|
|
679
726
|
<tbody>
|
|
680
727
|
<tr><td><code>0.6.0</code></td><td>`value` argument type changed to `Int8`</td></tr>
|
|
728
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setInt8`</td></tr>
|
|
681
729
|
</tbody>
|
|
682
730
|
</table>
|
|
683
731
|
</details>
|
|
@@ -690,11 +738,11 @@ Sets a signed 8-bit integer starting at the given byte index.
|
|
|
690
738
|
|
|
691
739
|
Parameters:
|
|
692
740
|
|
|
693
|
-
|param|type|description|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
741
|
+
| param | type | description |
|
|
742
|
+
| -------- | -------- | ------------------------ |
|
|
743
|
+
| `index` | `Number` | The byte index to update |
|
|
744
|
+
| `value` | `Int8` | The value to set |
|
|
745
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
698
746
|
|
|
699
747
|
Throws:
|
|
700
748
|
|
|
@@ -735,10 +783,10 @@ Appends a signed 8-bit integer to a buffer.
|
|
|
735
783
|
|
|
736
784
|
Parameters:
|
|
737
785
|
|
|
738
|
-
|param|type|description|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
786
|
+
| param | type | description |
|
|
787
|
+
| -------- | -------- | -------------------- |
|
|
788
|
+
| `value` | `Int8` | The value to append |
|
|
789
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
742
790
|
|
|
743
791
|
Examples:
|
|
744
792
|
|
|
@@ -770,16 +818,16 @@ Gets an unsigned 8-bit integer starting at the given byte index.
|
|
|
770
818
|
|
|
771
819
|
Parameters:
|
|
772
820
|
|
|
773
|
-
|param|type|description|
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
821
|
+
| param | type | description |
|
|
822
|
+
| -------- | -------- | ------------------------ |
|
|
823
|
+
| `index` | `Number` | The byte index to access |
|
|
824
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
777
825
|
|
|
778
826
|
Returns:
|
|
779
827
|
|
|
780
|
-
|type|description|
|
|
781
|
-
|
|
782
|
-
|
|
828
|
+
| type | description |
|
|
829
|
+
| ------- | -------------------------------------------------------- |
|
|
830
|
+
| `Uint8` | An unsigned 8-bit integer that starts at the given index |
|
|
783
831
|
|
|
784
832
|
Throws:
|
|
785
833
|
|
|
@@ -799,9 +847,18 @@ assert Buffer.getUint8(0, buf) == 3us
|
|
|
799
847
|
|
|
800
848
|
### Buffer.**setUint8**
|
|
801
849
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
850
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
851
|
+
|
|
852
|
+
<details>
|
|
853
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
854
|
+
<table>
|
|
855
|
+
<thead>
|
|
856
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
857
|
+
</thead>
|
|
858
|
+
<tbody>
|
|
859
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setUint8`</td></tr>
|
|
860
|
+
</tbody>
|
|
861
|
+
</table>
|
|
805
862
|
</details>
|
|
806
863
|
|
|
807
864
|
```grain
|
|
@@ -812,11 +869,11 @@ Sets an unsigned 8-bit integer starting at the given byte index.
|
|
|
812
869
|
|
|
813
870
|
Parameters:
|
|
814
871
|
|
|
815
|
-
|param|type|description|
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
872
|
+
| param | type | description |
|
|
873
|
+
| -------- | -------- | ------------------------ |
|
|
874
|
+
| `index` | `Number` | The byte index to update |
|
|
875
|
+
| `value` | `Uint8` | The value to set |
|
|
876
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
820
877
|
|
|
821
878
|
Throws:
|
|
822
879
|
|
|
@@ -850,10 +907,10 @@ Appends an unsigned 8-bit integer to a buffer.
|
|
|
850
907
|
|
|
851
908
|
Parameters:
|
|
852
909
|
|
|
853
|
-
|param|type|description|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
910
|
+
| param | type | description |
|
|
911
|
+
| -------- | -------- | -------------------- |
|
|
912
|
+
| `value` | `Uint8` | The value to append |
|
|
913
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
857
914
|
|
|
858
915
|
Examples:
|
|
859
916
|
|
|
@@ -885,16 +942,16 @@ Gets a signed 16-bit integer starting at the given byte index.
|
|
|
885
942
|
|
|
886
943
|
Parameters:
|
|
887
944
|
|
|
888
|
-
|param|type|description|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
945
|
+
| param | type | description |
|
|
946
|
+
| -------- | -------- | ------------------------ |
|
|
947
|
+
| `index` | `Number` | The byte index to access |
|
|
948
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
892
949
|
|
|
893
950
|
Returns:
|
|
894
951
|
|
|
895
|
-
|type|description|
|
|
896
|
-
|
|
897
|
-
|
|
952
|
+
| type | description |
|
|
953
|
+
| ------- | ------------------------------------------------------ |
|
|
954
|
+
| `Int16` | A signed 16-bit integer that starts at the given index |
|
|
898
955
|
|
|
899
956
|
Throws:
|
|
900
957
|
|
|
@@ -914,6 +971,8 @@ assert Buffer.getInt16(0, buf) == 1S
|
|
|
914
971
|
|
|
915
972
|
### Buffer.**setInt16**
|
|
916
973
|
|
|
974
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
975
|
+
|
|
917
976
|
<details>
|
|
918
977
|
<summary>Added in <code>0.4.0</code></summary>
|
|
919
978
|
<table>
|
|
@@ -922,6 +981,7 @@ assert Buffer.getInt16(0, buf) == 1S
|
|
|
922
981
|
</thead>
|
|
923
982
|
<tbody>
|
|
924
983
|
<tr><td><code>0.6.0</code></td><td>`value` argument type changed to `Int16`</td></tr>
|
|
984
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setInt16`</td></tr>
|
|
925
985
|
</tbody>
|
|
926
986
|
</table>
|
|
927
987
|
</details>
|
|
@@ -934,11 +994,11 @@ Sets a signed 16-bit integer starting at the given byte index.
|
|
|
934
994
|
|
|
935
995
|
Parameters:
|
|
936
996
|
|
|
937
|
-
|param|type|description|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
997
|
+
| param | type | description |
|
|
998
|
+
| -------- | -------- | ------------------------ |
|
|
999
|
+
| `index` | `Number` | The byte index to update |
|
|
1000
|
+
| `value` | `Int16` | The value to set |
|
|
1001
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
942
1002
|
|
|
943
1003
|
Throws:
|
|
944
1004
|
|
|
@@ -979,10 +1039,10 @@ Appends a signed 16-bit integer to a buffer.
|
|
|
979
1039
|
|
|
980
1040
|
Parameters:
|
|
981
1041
|
|
|
982
|
-
|param|type|description|
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1042
|
+
| param | type | description |
|
|
1043
|
+
| -------- | -------- | -------------------- |
|
|
1044
|
+
| `value` | `Int16` | The value to append |
|
|
1045
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
986
1046
|
|
|
987
1047
|
Examples:
|
|
988
1048
|
|
|
@@ -1014,16 +1074,16 @@ Gets an unsigned 16-bit integer starting at the given byte index.
|
|
|
1014
1074
|
|
|
1015
1075
|
Parameters:
|
|
1016
1076
|
|
|
1017
|
-
|param|type|description|
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1077
|
+
| param | type | description |
|
|
1078
|
+
| -------- | -------- | ------------------------ |
|
|
1079
|
+
| `index` | `Number` | The byte index to access |
|
|
1080
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1021
1081
|
|
|
1022
1082
|
Returns:
|
|
1023
1083
|
|
|
1024
|
-
|type|description|
|
|
1025
|
-
|
|
1026
|
-
|
|
1084
|
+
| type | description |
|
|
1085
|
+
| -------- | --------------------------------------------------------- |
|
|
1086
|
+
| `Uint16` | An unsigned 16-bit integer that starts at the given index |
|
|
1027
1087
|
|
|
1028
1088
|
Throws:
|
|
1029
1089
|
|
|
@@ -1043,9 +1103,18 @@ assert Buffer.getUint16(0, buf) == 1uS
|
|
|
1043
1103
|
|
|
1044
1104
|
### Buffer.**setUint16**
|
|
1045
1105
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1106
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1107
|
+
|
|
1108
|
+
<details>
|
|
1109
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
1110
|
+
<table>
|
|
1111
|
+
<thead>
|
|
1112
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1113
|
+
</thead>
|
|
1114
|
+
<tbody>
|
|
1115
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setUint16`</td></tr>
|
|
1116
|
+
</tbody>
|
|
1117
|
+
</table>
|
|
1049
1118
|
</details>
|
|
1050
1119
|
|
|
1051
1120
|
```grain
|
|
@@ -1056,11 +1125,11 @@ Sets an unsigned 16-bit integer starting at the given byte index.
|
|
|
1056
1125
|
|
|
1057
1126
|
Parameters:
|
|
1058
1127
|
|
|
1059
|
-
|param|type|description|
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1128
|
+
| param | type | description |
|
|
1129
|
+
| -------- | -------- | ------------------------ |
|
|
1130
|
+
| `index` | `Number` | The byte index to update |
|
|
1131
|
+
| `value` | `Uint16` | The value to set |
|
|
1132
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1064
1133
|
|
|
1065
1134
|
Throws:
|
|
1066
1135
|
|
|
@@ -1094,10 +1163,10 @@ Appends an unsigned 16-bit integer to a buffer.
|
|
|
1094
1163
|
|
|
1095
1164
|
Parameters:
|
|
1096
1165
|
|
|
1097
|
-
|param|type|description|
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1166
|
+
| param | type | description |
|
|
1167
|
+
| -------- | -------- | -------------------- |
|
|
1168
|
+
| `value` | `Uint16` | The value to append |
|
|
1169
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1101
1170
|
|
|
1102
1171
|
Examples:
|
|
1103
1172
|
|
|
@@ -1122,16 +1191,16 @@ Gets a signed 32-bit integer starting at the given byte index.
|
|
|
1122
1191
|
|
|
1123
1192
|
Parameters:
|
|
1124
1193
|
|
|
1125
|
-
|param|type|description|
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1194
|
+
| param | type | description |
|
|
1195
|
+
| -------- | -------- | ------------------------ |
|
|
1196
|
+
| `index` | `Number` | The byte index to access |
|
|
1197
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1129
1198
|
|
|
1130
1199
|
Returns:
|
|
1131
1200
|
|
|
1132
|
-
|type|description|
|
|
1133
|
-
|
|
1134
|
-
|
|
1201
|
+
| type | description |
|
|
1202
|
+
| ------- | ------------------------------------------------------ |
|
|
1203
|
+
| `Int32` | A signed 32-bit integer that starts at the given index |
|
|
1135
1204
|
|
|
1136
1205
|
Throws:
|
|
1137
1206
|
|
|
@@ -1151,9 +1220,18 @@ assert Buffer.getInt32(0, buf) == 1l
|
|
|
1151
1220
|
|
|
1152
1221
|
### Buffer.**setInt32**
|
|
1153
1222
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1223
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1224
|
+
|
|
1225
|
+
<details>
|
|
1226
|
+
<summary>Added in <code>0.4.0</code></summary>
|
|
1227
|
+
<table>
|
|
1228
|
+
<thead>
|
|
1229
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1230
|
+
</thead>
|
|
1231
|
+
<tbody>
|
|
1232
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setInt32`</td></tr>
|
|
1233
|
+
</tbody>
|
|
1234
|
+
</table>
|
|
1157
1235
|
</details>
|
|
1158
1236
|
|
|
1159
1237
|
```grain
|
|
@@ -1164,11 +1242,11 @@ Sets a signed 32-bit integer starting at the given byte index.
|
|
|
1164
1242
|
|
|
1165
1243
|
Parameters:
|
|
1166
1244
|
|
|
1167
|
-
|param|type|description|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1245
|
+
| param | type | description |
|
|
1246
|
+
| -------- | -------- | ------------------------ |
|
|
1247
|
+
| `index` | `Number` | The byte index to update |
|
|
1248
|
+
| `value` | `Int32` | The value to set |
|
|
1249
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1172
1250
|
|
|
1173
1251
|
Throws:
|
|
1174
1252
|
|
|
@@ -1202,10 +1280,10 @@ Appends a signed 32-bit integer to a buffer.
|
|
|
1202
1280
|
|
|
1203
1281
|
Parameters:
|
|
1204
1282
|
|
|
1205
|
-
|param|type|description|
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1283
|
+
| param | type | description |
|
|
1284
|
+
| -------- | -------- | -------------------- |
|
|
1285
|
+
| `value` | `Int32` | The value to append |
|
|
1286
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1209
1287
|
|
|
1210
1288
|
Examples:
|
|
1211
1289
|
|
|
@@ -1230,16 +1308,16 @@ Gets an unsigned 32-bit integer starting at the given byte index.
|
|
|
1230
1308
|
|
|
1231
1309
|
Parameters:
|
|
1232
1310
|
|
|
1233
|
-
|param|type|description|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1311
|
+
| param | type | description |
|
|
1312
|
+
| -------- | -------- | ------------------------ |
|
|
1313
|
+
| `index` | `Number` | The byte index to access |
|
|
1314
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1237
1315
|
|
|
1238
1316
|
Returns:
|
|
1239
1317
|
|
|
1240
|
-
|type|description|
|
|
1241
|
-
|
|
1242
|
-
|
|
1318
|
+
| type | description |
|
|
1319
|
+
| -------- | --------------------------------------------------------- |
|
|
1320
|
+
| `Uint32` | An unsigned 32-bit integer that starts at the given index |
|
|
1243
1321
|
|
|
1244
1322
|
Throws:
|
|
1245
1323
|
|
|
@@ -1259,9 +1337,18 @@ assert Buffer.getUint32(0, buf) == 1ul
|
|
|
1259
1337
|
|
|
1260
1338
|
### Buffer.**setUint32**
|
|
1261
1339
|
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1340
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1341
|
+
|
|
1342
|
+
<details>
|
|
1343
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
1344
|
+
<table>
|
|
1345
|
+
<thead>
|
|
1346
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1347
|
+
</thead>
|
|
1348
|
+
<tbody>
|
|
1349
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setUint32`</td></tr>
|
|
1350
|
+
</tbody>
|
|
1351
|
+
</table>
|
|
1265
1352
|
</details>
|
|
1266
1353
|
|
|
1267
1354
|
```grain
|
|
@@ -1272,11 +1359,11 @@ Sets an unsigned 32-bit integer starting at the given byte index.
|
|
|
1272
1359
|
|
|
1273
1360
|
Parameters:
|
|
1274
1361
|
|
|
1275
|
-
|param|type|description|
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1362
|
+
| param | type | description |
|
|
1363
|
+
| -------- | -------- | ------------------------ |
|
|
1364
|
+
| `index` | `Number` | The byte index to update |
|
|
1365
|
+
| `value` | `Uint32` | The value to set |
|
|
1366
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1280
1367
|
|
|
1281
1368
|
Throws:
|
|
1282
1369
|
|
|
@@ -1310,10 +1397,10 @@ Appends an unsigned 32-bit integer to a buffer.
|
|
|
1310
1397
|
|
|
1311
1398
|
Parameters:
|
|
1312
1399
|
|
|
1313
|
-
|param|type|description|
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1400
|
+
| param | type | description |
|
|
1401
|
+
| -------- | -------- | -------------------- |
|
|
1402
|
+
| `value` | `Uint32` | The value to append |
|
|
1403
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1317
1404
|
|
|
1318
1405
|
Examples:
|
|
1319
1406
|
|
|
@@ -1338,16 +1425,16 @@ Gets a 32-bit float starting at the given byte index.
|
|
|
1338
1425
|
|
|
1339
1426
|
Parameters:
|
|
1340
1427
|
|
|
1341
|
-
|param|type|description|
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1428
|
+
| param | type | description |
|
|
1429
|
+
| -------- | -------- | ------------------------ |
|
|
1430
|
+
| `index` | `Number` | The byte index to access |
|
|
1431
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1345
1432
|
|
|
1346
1433
|
Returns:
|
|
1347
1434
|
|
|
1348
|
-
|type|description|
|
|
1349
|
-
|
|
1350
|
-
|
|
1435
|
+
| type | description |
|
|
1436
|
+
| --------- | --------------------------------------------- |
|
|
1437
|
+
| `Float32` | A 32-bit float that starts at the given index |
|
|
1351
1438
|
|
|
1352
1439
|
Throws:
|
|
1353
1440
|
|
|
@@ -1367,9 +1454,18 @@ assert Buffer.getFloat32(0, buf) == 1.0f
|
|
|
1367
1454
|
|
|
1368
1455
|
### Buffer.**setFloat32**
|
|
1369
1456
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1457
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1458
|
+
|
|
1459
|
+
<details>
|
|
1460
|
+
<summary>Added in <code>0.4.0</code></summary>
|
|
1461
|
+
<table>
|
|
1462
|
+
<thead>
|
|
1463
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1464
|
+
</thead>
|
|
1465
|
+
<tbody>
|
|
1466
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setFloat32`</td></tr>
|
|
1467
|
+
</tbody>
|
|
1468
|
+
</table>
|
|
1373
1469
|
</details>
|
|
1374
1470
|
|
|
1375
1471
|
```grain
|
|
@@ -1380,11 +1476,11 @@ Sets a 32-bit float starting at the given byte index.
|
|
|
1380
1476
|
|
|
1381
1477
|
Parameters:
|
|
1382
1478
|
|
|
1383
|
-
|param|type|description|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1479
|
+
| param | type | description |
|
|
1480
|
+
| -------- | --------- | ------------------------ |
|
|
1481
|
+
| `index` | `Number` | The byte index to update |
|
|
1482
|
+
| `value` | `Float32` | The value to set |
|
|
1483
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1388
1484
|
|
|
1389
1485
|
Throws:
|
|
1390
1486
|
|
|
@@ -1418,10 +1514,10 @@ Appends a 32-bit float to a buffer.
|
|
|
1418
1514
|
|
|
1419
1515
|
Parameters:
|
|
1420
1516
|
|
|
1421
|
-
|param|type|description|
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1517
|
+
| param | type | description |
|
|
1518
|
+
| -------- | --------- | -------------------- |
|
|
1519
|
+
| `value` | `Float32` | The value to append |
|
|
1520
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1425
1521
|
|
|
1426
1522
|
Examples:
|
|
1427
1523
|
|
|
@@ -1446,16 +1542,16 @@ Gets a signed 64-bit integer starting at the given byte index.
|
|
|
1446
1542
|
|
|
1447
1543
|
Parameters:
|
|
1448
1544
|
|
|
1449
|
-
|param|type|description|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1545
|
+
| param | type | description |
|
|
1546
|
+
| -------- | -------- | ------------------------ |
|
|
1547
|
+
| `index` | `Number` | The byte index to access |
|
|
1548
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1453
1549
|
|
|
1454
1550
|
Returns:
|
|
1455
1551
|
|
|
1456
|
-
|type|description|
|
|
1457
|
-
|
|
1458
|
-
|
|
1552
|
+
| type | description |
|
|
1553
|
+
| ------- | ------------------------------------------------------ |
|
|
1554
|
+
| `Int64` | A signed 64-bit integer that starts at the given index |
|
|
1459
1555
|
|
|
1460
1556
|
Throws:
|
|
1461
1557
|
|
|
@@ -1475,9 +1571,18 @@ assert Buffer.getInt64(0, buf) == 1L
|
|
|
1475
1571
|
|
|
1476
1572
|
### Buffer.**setInt64**
|
|
1477
1573
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1574
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1575
|
+
|
|
1576
|
+
<details>
|
|
1577
|
+
<summary>Added in <code>0.4.0</code></summary>
|
|
1578
|
+
<table>
|
|
1579
|
+
<thead>
|
|
1580
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1581
|
+
</thead>
|
|
1582
|
+
<tbody>
|
|
1583
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setInt64</td></tr>
|
|
1584
|
+
</tbody>
|
|
1585
|
+
</table>
|
|
1481
1586
|
</details>
|
|
1482
1587
|
|
|
1483
1588
|
```grain
|
|
@@ -1488,11 +1593,11 @@ Sets a signed 64-bit integer starting at the given byte index.
|
|
|
1488
1593
|
|
|
1489
1594
|
Parameters:
|
|
1490
1595
|
|
|
1491
|
-
|param|type|description|
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1596
|
+
| param | type | description |
|
|
1597
|
+
| -------- | -------- | ------------------------ |
|
|
1598
|
+
| `index` | `Number` | The byte index to update |
|
|
1599
|
+
| `value` | `Int64` | The value to set |
|
|
1600
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1496
1601
|
|
|
1497
1602
|
Throws:
|
|
1498
1603
|
|
|
@@ -1526,10 +1631,10 @@ Appends a signed 64-bit integer to a buffer.
|
|
|
1526
1631
|
|
|
1527
1632
|
Parameters:
|
|
1528
1633
|
|
|
1529
|
-
|param|type|description|
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1634
|
+
| param | type | description |
|
|
1635
|
+
| -------- | -------- | -------------------- |
|
|
1636
|
+
| `value` | `Int64` | The value to set |
|
|
1637
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1533
1638
|
|
|
1534
1639
|
Examples:
|
|
1535
1640
|
|
|
@@ -1554,16 +1659,16 @@ Gets an unsigned 64-bit integer starting at the given byte index.
|
|
|
1554
1659
|
|
|
1555
1660
|
Parameters:
|
|
1556
1661
|
|
|
1557
|
-
|param|type|description|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1662
|
+
| param | type | description |
|
|
1663
|
+
| -------- | -------- | ------------------------ |
|
|
1664
|
+
| `index` | `Number` | The byte index to access |
|
|
1665
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1561
1666
|
|
|
1562
1667
|
Returns:
|
|
1563
1668
|
|
|
1564
|
-
|type|description|
|
|
1565
|
-
|
|
1566
|
-
|
|
1669
|
+
| type | description |
|
|
1670
|
+
| -------- | --------------------------------------------------------- |
|
|
1671
|
+
| `Uint64` | An unsigned 64-bit integer that starts at the given index |
|
|
1567
1672
|
|
|
1568
1673
|
Throws:
|
|
1569
1674
|
|
|
@@ -1583,9 +1688,18 @@ assert Buffer.getUint64(0, buf) == 1uL
|
|
|
1583
1688
|
|
|
1584
1689
|
### Buffer.**setUint64**
|
|
1585
1690
|
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1691
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1692
|
+
|
|
1693
|
+
<details>
|
|
1694
|
+
<summary>Added in <code>0.6.0</code></summary>
|
|
1695
|
+
<table>
|
|
1696
|
+
<thead>
|
|
1697
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1698
|
+
</thead>
|
|
1699
|
+
<tbody>
|
|
1700
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setUint64`</td></tr>
|
|
1701
|
+
</tbody>
|
|
1702
|
+
</table>
|
|
1589
1703
|
</details>
|
|
1590
1704
|
|
|
1591
1705
|
```grain
|
|
@@ -1596,11 +1710,11 @@ Sets an unsigned 64-bit integer starting at the given byte index.
|
|
|
1596
1710
|
|
|
1597
1711
|
Parameters:
|
|
1598
1712
|
|
|
1599
|
-
|param|type|description|
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1713
|
+
| param | type | description |
|
|
1714
|
+
| -------- | -------- | ------------------------ |
|
|
1715
|
+
| `index` | `Number` | The byte index to update |
|
|
1716
|
+
| `value` | `Uint64` | The value to set |
|
|
1717
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1604
1718
|
|
|
1605
1719
|
Throws:
|
|
1606
1720
|
|
|
@@ -1634,10 +1748,10 @@ Appends an unsigned 64-bit integer to a buffer.
|
|
|
1634
1748
|
|
|
1635
1749
|
Parameters:
|
|
1636
1750
|
|
|
1637
|
-
|param|type|description|
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1751
|
+
| param | type | description |
|
|
1752
|
+
| -------- | -------- | -------------------- |
|
|
1753
|
+
| `value` | `Uint64` | The value to set |
|
|
1754
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1641
1755
|
|
|
1642
1756
|
Examples:
|
|
1643
1757
|
|
|
@@ -1662,16 +1776,16 @@ Gets a 64-bit float starting at the given byte index.
|
|
|
1662
1776
|
|
|
1663
1777
|
Parameters:
|
|
1664
1778
|
|
|
1665
|
-
|param|type|description|
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1779
|
+
| param | type | description |
|
|
1780
|
+
| -------- | -------- | ------------------------ |
|
|
1781
|
+
| `index` | `Number` | The byte index to access |
|
|
1782
|
+
| `buffer` | `Buffer` | The buffer to access |
|
|
1669
1783
|
|
|
1670
1784
|
Returns:
|
|
1671
1785
|
|
|
1672
|
-
|type|description|
|
|
1673
|
-
|
|
1674
|
-
|
|
1786
|
+
| type | description |
|
|
1787
|
+
| --------- | --------------------------------------------- |
|
|
1788
|
+
| `Float64` | A 64-bit float that starts at the given index |
|
|
1675
1789
|
|
|
1676
1790
|
Throws:
|
|
1677
1791
|
|
|
@@ -1691,9 +1805,18 @@ assert Buffer.getFloat64(0, buf) == 1.0F
|
|
|
1691
1805
|
|
|
1692
1806
|
### Buffer.**setFloat64**
|
|
1693
1807
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1808
|
+
> **Deprecated:** Use `Bytes` instead of `Buffer` for set operations.
|
|
1809
|
+
|
|
1810
|
+
<details>
|
|
1811
|
+
<summary>Added in <code>0.4.0</code></summary>
|
|
1812
|
+
<table>
|
|
1813
|
+
<thead>
|
|
1814
|
+
<tr><th>version</th><th>changes</th></tr>
|
|
1815
|
+
</thead>
|
|
1816
|
+
<tbody>
|
|
1817
|
+
<tr><td><code>0.7.1</code></td><td>Deprecated in favor of `Bytes.setFloat64`</td></tr>
|
|
1818
|
+
</tbody>
|
|
1819
|
+
</table>
|
|
1697
1820
|
</details>
|
|
1698
1821
|
|
|
1699
1822
|
```grain
|
|
@@ -1704,11 +1827,11 @@ Sets a 64-bit float starting at the given byte index.
|
|
|
1704
1827
|
|
|
1705
1828
|
Parameters:
|
|
1706
1829
|
|
|
1707
|
-
|param|type|description|
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1830
|
+
| param | type | description |
|
|
1831
|
+
| -------- | --------- | ------------------------ |
|
|
1832
|
+
| `index` | `Number` | The byte index to update |
|
|
1833
|
+
| `value` | `Float64` | The value to set |
|
|
1834
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1712
1835
|
|
|
1713
1836
|
Throws:
|
|
1714
1837
|
|
|
@@ -1742,10 +1865,10 @@ Appends a 64-bit float to a buffer.
|
|
|
1742
1865
|
|
|
1743
1866
|
Parameters:
|
|
1744
1867
|
|
|
1745
|
-
|param|type|description|
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1868
|
+
| param | type | description |
|
|
1869
|
+
| -------- | --------- | -------------------- |
|
|
1870
|
+
| `value` | `Float64` | The value to append |
|
|
1871
|
+
| `buffer` | `Buffer` | The buffer to mutate |
|
|
1749
1872
|
|
|
1750
1873
|
Examples:
|
|
1751
1874
|
|