bireader 1.0.59 → 2.0.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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # bireader
1
+ # BiReader
2
2
 
3
3
  A feature rich binary reader and writer that keeps track of your position to quickly create file structures. Includes shared naming conventions, programmable inputs and advanced math for easy data conversions to do low level parsing. Accepts `Uint8Array` or `Buffer`.
4
4
 
@@ -27,12 +27,12 @@ Import the reader or writer. Create a new parser with the data and start parsing
27
27
  Includes presents for quick parsing or programmable functions (examples below).
28
28
 
29
29
  ```javascript
30
- import {bireader, biwriter} from 'bireader';
30
+ import {BiReader, BiWriter} from 'bireader';
31
31
 
32
- //read example - parse a webp file
32
+ // read example - parse a webp file
33
33
  function parse_webp(data){
34
- const br = new bireader(data)
35
- br.hexdump({supressUnicode:true}) //console.log data as hex
34
+ const br = new BiReader(data);
35
+ br.hexdump({supressUnicode:true}); // console.log data as hex
36
36
 
37
37
  // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
38
38
  // 00000 52 49 46 46 98 3a 00 00 57 45 42 50 56 50 38 58 RIFF.:..WEBPVP8X
@@ -48,225 +48,225 @@ function parse_webp(data){
48
48
  // 000a0 52 b8 8e 65 a9 eb 38 ce ab 52 75 9d 67 ff 75 2f R..e..8..Ru.g.u/
49
49
  // 000b0 77 44 40 94 6d 25 6c 74 91 a8 88 86 58 9b da 6e wD@.m%lt....X..n
50
50
 
51
- const header = {}
52
- header.magic = br.string({length:4}) //RIFF
53
- header.size = br.uint32le() //15000
54
- header.fileSize = header.size + 8 //15008
55
- header.payload = br.string({length:4}) //WEBP
56
- header.format = br.string({length:4}) //VP8X
57
- header.formatChunkSize = br.uint32le() //10
51
+ const header = {};
52
+ header.magic = br.string({length:4}); // RIFF
53
+ header.size = br.uint32le; // 15000
54
+ header.fileSize = header.size + 8; // 15008
55
+ header.payload = br.string({length:4}); // WEBP
56
+ header.format = br.string({length:4}); // VP8X
57
+ header.formatChunkSize = br.uint32le; // 10
58
58
  switch (header.format){
59
59
  case "VP8 ":
60
- header.formatType = "Lossy"
61
- var read_size = 0
62
- header.frame_tag = br.ubit24()
60
+ header.formatType = "Lossy";
61
+ var read_size = 0;
62
+ header.frame_tag = br.ubit24;
63
63
  read_size += 3;
64
64
  header.key_frame = header.frame_tag & 0x1;
65
65
  header.version = (header.frame_tag >> 1) & 0x7;
66
66
  header.show_frame = (header.frame_tag >> 4) & 0x1;
67
67
  header.first_part_size = (header.frame_tag >> 5) & 0x7FFFF;
68
- header.start_code = br.ubit24() //should be 2752925
69
- header.horizontal_size_code = br.ubit16();
68
+ header.start_code = br.ubit24; // should be 2752925
69
+ header.horizontal_size_code = br.ubit16;
70
70
  header.width = header.horizontal_size_code & 0x3FFF;
71
71
  header.horizontal_scale = header.horizontal_size_code >> 14;
72
- header.vertical_size_code = br.ubit16();
72
+ header.vertical_size_code = br.ubit16;
73
73
  header.height = header.vertical_size_code & 0x3FFF;
74
74
  header.vertical_scale = header.vertical_size_code >> 14;
75
75
  read_size += 7;
76
- header.VP8data = br.extract(header.formatChunkSize - read_size, true)
76
+ header.VP8data = br.extract(header.formatChunkSize - read_size, true);
77
77
  break;
78
78
  case "VP8L":
79
- header.formatType = "Lossless"
80
- var read_size = 0
81
- header.signature = br.ubyte() //should be 47
79
+ header.formatType = "Lossless";
80
+ var read_size = 0;
81
+ header.signature = br.ubyte; // should be 47
82
82
  read_size += 1;
83
- header.readWidth = br.ubit14()
83
+ header.readWidth = br.ubit14;
84
84
  header.width = header.readWidth+1;
85
- header.readHeight = br.ubit14()
85
+ header.readHeight = br.ubit14;
86
86
  header.height = header.readHeight+1;
87
- header.alpha_is_used = br.bit1()
88
- header.version_number = br.ubit3()
87
+ header.alpha_is_used = br.bit1;
88
+ header.version_number = br.ubit3;
89
89
  read_size += 4;
90
- header.VP8Ldata = br.extract(header.formatChunkSize - read_size, true)
90
+ header.VP8Ldata = br.extract(header.formatChunkSize - read_size, true);
91
91
  break;
92
92
  case "VP8X":
93
- header.formatType = "Extended"
94
- br.big() //switch to Big Endian bit read
95
- header.rsv = br.bit2() //Reserved
96
- header.I = br.bit1() //ICC profile
97
- header.L = br.bit1() //Alpha
98
- header.E = br.bit1() //Exif
99
- header.X = br.bit1() //XMP
100
- header.A = br.bit1() //Animation
101
- header.R = br.bit1() //Reserved
102
- br.little() //return to little
103
- header.rsv2 = br.ubit24()
104
- header.widthMinus1 = br.ubit24()
93
+ header.formatType = "Extended";
94
+ br.big(); // switch to Big Endian bit read
95
+ header.rsv = br.bit2; // Reserved
96
+ header.I = br.bit1; // ICC profile
97
+ header.L = br.bit1; // Alpha
98
+ header.E = br.bit1; // Exif
99
+ header.X = br.bit1; // XMP
100
+ header.A = br.bit1; // Animation
101
+ header.R = br.bit1; // Reserved
102
+ br.little(); // return to little
103
+ header.rsv2 = br.ubit24;
104
+ header.widthMinus1 = br.ubit24;
105
105
  header.width = header.widthMinus1 + 1
106
- header.heightMinus1 = br.ubit24()
106
+ header.heightMinus1 = br.ubit24;
107
107
  header.height = header.heightMinus1 + 1
108
108
  if(header.I)
109
109
  {
110
- header.ICCP = br.string({length:4}) // Should be ICCP
111
- header.ICCPChunkSize = br.uint32()
112
- header.ICCPData = br.extract(header.ICCPChunkSize, true)
110
+ header.ICCP = br.string({length:4}); // Should be ICCP
111
+ header.ICCPChunkSize = br.uint32;
112
+ header.ICCPData = br.extract(header.ICCPChunkSize, true);
113
113
  }
114
114
  if(header.L)
115
115
  {
116
- header.ALPH = br.string({length:4}) // Should be ALPH
117
- header.ALPHChunkSize = br.uint32() //4134
118
- header.ALPHData = br.extract(header.ALPHChunkSize, true)
116
+ header.ALPH = br.string({length:4}); // Should be ALPH
117
+ header.ALPHChunkSize = br.uint32; // 4134
118
+ header.ALPHData = br.extract(header.ALPHChunkSize, true);
119
119
  }
120
120
  if(header.A)
121
121
  {
122
- header.ANI = br.string({length:4}) // Should be ANIM or ANIF
123
- header.ANIChunkSize = br.uint32()
122
+ header.ANI = br.string({length:4}); // Should be ANIM or ANIF
123
+ header.ANIChunkSize = br.uint32;
124
124
  if(header.ANI == "ANIM")
125
125
  {
126
- header.BGColor = br.uint32()
127
- header.loopCount = br.ushort()
128
- header.ANIMData = br.extract(header.ANIChunkSize, true)
126
+ header.BGColor = br.uint32;
127
+ header.loopCount = br.ushort;
128
+ header.ANIMData = br.extract(header.ANIChunkSize, true);
129
129
  } else
130
130
  if (header.ANI == "ANIF")
131
131
  {
132
- header.FrameX = br.ubit24()
133
- header.FrameY = br.ubit24()
134
- header.readFrameWidth = br.ubit24()
135
- header.readFrameHeight = br.ubit24()
136
- header.frameWidth = readFrameWidth + 1
137
- header.frameHeight = readFrameHeight + 1
138
- header.duration = br.ubit24()
139
- header.rsv3 = br.ubit6()
140
- header.byte.B = br.bit1() //Blending
141
- header.byte.D = br.bit1() //Disposal
142
- header.frameData = br.extract(16, true)
143
- header.ANIFData = br.extract(header.ANIChunkSize, true)
132
+ header.FrameX = br.ubit24;
133
+ header.FrameY = br.ubit24;
134
+ header.readFrameWidth = br.ubit24;
135
+ header.readFrameHeight = br.ubit24;
136
+ header.frameWidth = readFrameWidth + 1;
137
+ header.frameHeight = readFrameHeight + 1;
138
+ header.duration = br.ubit24;
139
+ header.rsv3 = br.ubit6;
140
+ header.byte.B = br.bit1; // Blending
141
+ header.byte.D = br.bit1; // Disposal
142
+ header.frameData = br.extract(16, true);
143
+ header.ANIFData = br.extract(header.ANIChunkSize, true);
144
144
  }
145
145
  }
146
- header.extFormatStr = br.string({length:4})
147
- header.extChunkSize = br.uint32()
148
- header.extData = br.extract(header.extChunkSize, true)
146
+ header.extFormatStr = br.string({length:4});
147
+ header.extChunkSize = br.uint32;
148
+ header.extData = br.extract(header.extChunkSize, true);
149
149
  if(header.E)
150
150
  {
151
- header.EXIF = br.string({length:4}) // Should be EXIF
152
- header.EXIFChunkSize = br.uint32()
153
- header.EXIFData = br.extract(header.EXIFChunkSize, true)
151
+ header.EXIF = br.string({length:4}); // Should be EXIF
152
+ header.EXIFChunkSize = br.uint32;
153
+ header.EXIFData = br.extract(header.EXIFChunkSize, true);
154
154
  }
155
155
  if(header.X)
156
156
  {
157
- header.XMP = br.string({length:4}) // Should be XMP
158
- header.XMPChunkSize = br.uint32()
159
- header.XMPMetaData = br.extract(header.XMPChunkSize, true)
157
+ header.XMP = br.string({length:4}); // Should be XMP
158
+ header.XMPChunkSize = br.uint32;
159
+ header.XMPMetaData = br.extract(header.XMPChunkSize, true);
160
160
  }
161
161
  break;
162
162
  default:
163
- header.data = br.extract(header.formatChunkSize, true)
163
+ header.data = br.extract(header.formatChunkSize, true);
164
164
  break;
165
165
  }
166
- br.finished()
167
- return header
166
+ br.finished();
167
+ return header;
168
168
  }
169
169
 
170
- //write example - write a webp file from read data
170
+ // write example - write a webp file from read data
171
171
  function write_webp(data){
172
- const bw = new biwriter(new Uint8Arry(0x100000)) // Will extends array as we write if needed by default
173
- bw.string("RIFF",{length:4})
174
- bw.uint32le(0) //dummy for now, will be final size - 8
175
- bw.string("WEBP",{length:4})
172
+ const bw = new BiWriter(new Uint8Arry(0x100000)); // Will extends array as we write if needed by default
173
+ bw.string("RIFF",{length:4});
174
+ bw.uint32le = 0; // dummy for now, will be final size - 8
175
+ bw.string("WEBP",{length:4});
176
176
  switch(data.format){
177
177
  case "VP8 ":
178
- bw.string("VP8 ",{length:4})
179
- bw.uint32le(data.VP8data.length)
180
- bw.ubit24(data.key_frame)
181
- bw.ubit24(data.start_code)
182
- bw.ubit16(data.horizontal_size_code)
183
- bw.ubit16(data.vertical_size_code)
184
- bw.overwrite(data.VP8data ,true)
178
+ bw.string("VP8 ",{length:4});
179
+ bw.uint32le = data.VP8data.length;
180
+ bw.ubit24 = data.key_frame;
181
+ bw.ubit24 = data.start_code;
182
+ bw.ubit16 = data.horizontal_size_code;
183
+ bw.ubit16 = data.vertical_size_code;
184
+ bw.overwrite(data.VP8data ,true);
185
185
  break;
186
186
  case "VP8L":
187
- bw.string("VP8L",{length:4})
188
- bw.uint32le(data.VP8Ldata.length - 4)
189
- bw.ubyte(47)
190
- bw.ubit14(data.width - 1)
191
- bw.ubit14(data.heigth - 1)
192
- bw.ubit1(data.alpha_is_used)
193
- bw.bit3(data.version_number)
194
- bw.overwrite(data.VP8Ldata,true)
187
+ bw.string("VP8L",{length:4});
188
+ bw.uint32le = data.VP8Ldata.length - 4;
189
+ bw.ubyte = 47;
190
+ bw.ubit14 = data.width - 1;
191
+ bw.ubit14 = data.heigth - 1;
192
+ bw.ubit1 = data.alpha_is_used;
193
+ bw.bit3 = data.version_number;
194
+ bw.overwrite(data.VP8Ldata,true);
195
195
  break;
196
196
  case "VP8X":
197
- bw.string("VP8X",{length:4})
198
- bw.uint32le(10)
199
- bw.big()
200
- bw.bit2(0)
201
- bw.bit1(data.I)
202
- bw.bit1(data.L)
203
- bw.bit1(data.E)
204
- bw.bit1(data.X)
205
- bw.bit1(data.A)
206
- bw.bit1(0)
207
- bw.little()
208
- bw.ubit24(data.rsv2)
209
- bw.ubit24(data.width - 1)
210
- bw.ubit24(data.height - 1)
197
+ bw.string("VP8X",{length:4});
198
+ bw.uint32le = 10;
199
+ bw.big();
200
+ bw.bit2 = 0;
201
+ bw.bit1 = data.I;
202
+ bw.bit1 = data.L;
203
+ bw.bit1 = data.E;
204
+ bw.bit1 = data.X;
205
+ bw.bit1 = data.A;
206
+ bw.bit1 = 0;
207
+ bw.little();
208
+ bw.ubit24 = data.rsv2;
209
+ bw.ubit24 = data.width - 1;
210
+ bw.ubit24 = data.height - 1;
211
211
  if(data.I)
212
212
  {
213
- bw.string(data.ICCP, {length:4})
214
- bw.uint32(data.ICCPData.length)
215
- bw.replace(data.ICCPData, true)
213
+ bw.string(data.ICCP, {length:4});
214
+ bw.uint32 = data.ICCPData.length;;
215
+ bw.replace(data.ICCPData, true);
216
216
  }
217
217
  if(data.L)
218
218
  {
219
- bw.string(data.ALPH, {length:4})
220
- bw.uint32(data.ALPHData.length)
221
- bw.replace(data.ALPHData)
219
+ bw.string(data.ALPH, {length:4});
220
+ bw.uint32 = data.ALPHData.length;
221
+ bw.replace(data.ALPHData);
222
222
  }
223
223
  if(data.A)
224
224
  {
225
- bw.string(data.ANI, {length:4})
226
- bw.uint32(data.ANIChunkSize)
225
+ bw.string(data.ANI, {length:4});
226
+ bw.uint32 = data.ANIChunkSize;
227
227
  if(data.ANI == "ANIM")
228
228
  {
229
- bw.uint32(data.BGColor)
230
- bw.ushort(data.loopCount)
231
- bw.replace(data.ANIMData)
229
+ bw.uint32 = data.BGColor;
230
+ bw.ushort = data.loopCount;
231
+ bw.replace(data.ANIMData);
232
232
  } else
233
233
  if (data.ANI == "ANIF")
234
234
  {
235
- bw.ubit24(data.FrameX)
236
- bw.ubit24(data.FrameY)
237
- bw.ubit24(data.frameWidth - 1)
238
- bw.ubit24(data.frameHeigh - 1)
239
- bw.ubit24(data.duration)
240
- bw.ubit6(data.rsv3)
241
- bw.bit1(data.byte.B)
242
- bw.bit1(data.byte.D)
243
- bw.replace(data.frameData, true)
244
- bw.replace(data.ANIFData, true)
235
+ bw.ubit24 = data.FrameX;
236
+ bw.ubit24 = data.FrameY;
237
+ bw.ubit24 = data.frameWidth - 1;
238
+ bw.ubit24 = data.frameHeigh - 1;
239
+ bw.ubit24 = data.duration;
240
+ bw.ubit6 data.rsv3;
241
+ bw.bit1 = data.byte.B;
242
+ bw.bit1 = data.byte.D;
243
+ bw.replace(data.frameData, true);
244
+ bw.replace(data.ANIFData, true);
245
245
  }
246
246
  }
247
- bw.string(data.extFormatStr, {length:4})
248
- bw.uint32(data.extData.length)
249
- bw.replace(data.extData, true)
247
+ bw.string(data.extFormatStr, {length:4});
248
+ bw.uint32 = data.extData.length;
249
+ bw.replace(data.extData, true);
250
250
  if(data.E)
251
251
  {
252
- bw.string(data.EXIF, {length:4})
253
- bw.uint32(data.EXIFData.length)
254
- bw.replace( data.EXIFData, true)
252
+ bw.string(data.EXIF, {length:4});
253
+ bw.uint32 = data.EXIFData.length;
254
+ bw.replace( data.EXIFData, true);
255
255
  }
256
256
  if(data.X)
257
257
  {
258
- bw.string(data.XMP, {length:4})
259
- bw.uint32(data.XMPMetaData.length)
260
- bw.replace(data.XMPMetaData, true)
258
+ bw.string(data.XMP, {length:4});
259
+ bw.uint32 = data.XMPMetaData.length;
260
+ bw.replace(data.XMPMetaData, true);
261
261
  }
262
262
  break;
263
263
  default:
264
264
  break;
265
265
  }
266
- bw.trim() //remove any remaining bytes
267
- bw.goto(4)
268
- bw.uint32le(bw.size - 8) //write file size
269
- return bw.return()
266
+ bw.trim(); // remove any remaining bytes
267
+ bw.goto(4);
268
+ bw.uint32le = bw.size - 8; // write file size
269
+ return bw.return();
270
270
  }
271
271
  ```
272
272
 
@@ -288,14 +288,14 @@ Common functions for setup, movement, manipulation and math shared by both.
288
288
  <tr>
289
289
  <tr>
290
290
  <td>Name</td>
291
- <td>new bireader(<b>data</b>, byteOffset, bitOffset, endianess, strict)</td>
291
+ <td>new BiReader(<b>data</b>, byteOffset, bitOffset, endianess, strict)</td>
292
292
  <td align="center" rowspan="2"><b>Buffer or Uint8Array</b>, byte offset (default 0), bit offset (default 0), endian big or little (default little), strict mode true to restrict extending initially supplied data (default true for reader, false for writer)
293
293
  </td>
294
- <td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> Supplied data can always be found with .data.<br><br><b>biwriter note:</b> while biwriter can be created with a 0 length Uint8array or Buffer, each new value write will create a new array and concat the two. For large data writes this will lead to a degraded performance. It's best to supply a larger than needed buffer to start and use .trim() after you're finished.</td>
294
+ <td rowspan="2">Start with new Constructor.<br><br><b>Note:</b> Supplied data can always be found with .data.<br><br><b>BiWriter note:</b> while BiWriter can be created with a 0 length Uint8array or Buffer, each new value write will create a new array and concat the two. For large data writes this will lead to a degraded performance. It's best to supply a larger than needed buffer to start and use .trim() after you're finished.</td>
295
295
  </tr>
296
296
  <tr>
297
297
  <td>Name</td>
298
- <td>new biwriter(data, byteOffset, bitOffset, endianess, strict)</td>
298
+ <td>new BiWriter(data, byteOffset, bitOffset, endianess, strict)</td>
299
299
  </tr>
300
300
  <tr>
301
301
  <td>Name</td>
@@ -309,93 +309,93 @@ Common functions for setup, movement, manipulation and math shared by both.
309
309
  </tr>
310
310
  <tr>
311
311
  <td>Name</td>
312
- <td>length()</td>
312
+ <td>length</td>
313
313
  <td align="center" rowspan="2">none</td>
314
314
  <td rowspan="2">Gets the current buffer size in bytes.</td>
315
315
  </tr>
316
316
  <tr>
317
317
  <td>Aliases</td>
318
- <td>size, FileSize()</td>
318
+ <td>len, size, FileSize</td>
319
319
  </tr>
320
320
  <tr>
321
321
  <td>Name</td>
322
- <td>lengthB()</td>
322
+ <td>lengthB</td>
323
323
  <td align="center" rowspan="2">none</td>
324
324
  <td rowspan="2">Gets the current buffer size in bits.</td>
325
325
  </tr>
326
326
  <tr>
327
327
  <td>Aliases</td>
328
- <td>sizeB, FileSizeB()</td>
328
+ <td>lenb, sizeB, FileSizeB</td>
329
329
  </tr>
330
330
  <tr>
331
331
  <td>Name</td>
332
- <td>getOffset()</td>
332
+ <td>getOffset</td>
333
333
  <td align="center" rowspan="2">none</td>
334
334
  <td rowspan="2">Gets current byte position.</td>
335
335
  </tr>
336
336
  <tr>
337
337
  <td>Aliases</td>
338
- <td>FTell(), tell(), saveOffset()</td>
338
+ <td>off, FTell, tell, saveOffset</td>
339
339
  </tr>
340
340
  <tr>
341
341
  <td>Name</td>
342
- <td>getOffsetBit()</td>
342
+ <td>getOffsetBit</td>
343
343
  <td align="center" rowspan="2">none</td>
344
344
  <td rowspan="2">Gets current byte's bit position (0-7).</td>
345
345
  </tr>
346
346
  <tr>
347
347
  <td>Aliases</td>
348
- <td>FTellB(), tellB(), saveOffsetBit()</td>
348
+ <td>offb, FTellB, tellB, saveOffsetBit</td>
349
349
  </tr>
350
350
  <tr>
351
351
  <td>Name</td>
352
- <td>getOffsetAbsBit()</td>
352
+ <td>getOffsetAbsBit</td>
353
353
  <td align="center" rowspan="2">none</td>
354
354
  <td rowspan="2">Gets current absolute bit position from start of data.</td>
355
355
  </tr>
356
356
  <tr>
357
357
  <td>Aliases</td>
358
- <td>tellAbsB(), saveOffsetAbsBit()</td>
358
+ <td>offab, tellAbsB, saveOffsetAbsBit</td>
359
359
  </tr>
360
360
  <tr>
361
361
  <td>Name</td>
362
- <td>remain()</td>
362
+ <td>remain</td>
363
363
  <td align="center" rowspan="2">none</td>
364
364
  <td rowspan="2">Size in bytes of current read position to the end.</td>
365
365
  </tr>
366
366
  <tr>
367
367
  <td>Aliases</td>
368
- <td>FEoF()</td>
368
+ <td>FEoF</td>
369
369
  </tr>
370
370
  <tr>
371
371
  <td>Name</td>
372
- <td>remainB()</td>
372
+ <td>remainB</td>
373
373
  <td align="center" rowspan="2">none</td>
374
374
  <td rowspan="2">Size in bits of current read position to the end.</td>
375
375
  </tr>
376
376
  <tr>
377
377
  <td>Aliases</td>
378
- <td>FEoFB()</td>
378
+ <td>FEoFB</td>
379
379
  </tr>
380
380
  <tr>
381
381
  <td>Name</td>
382
- <td>getLine()</td>
382
+ <td>getLine</td>
383
383
  <td align="center" rowspan="2">none</td>
384
384
  <td rowspan="2">Row line of the file (16 bytes per row).</td>
385
385
  </tr>
386
386
  <tr>
387
387
  <td>Aliases</td>
388
- <td>row()</td>
388
+ <td>row</td>
389
389
  </tr>
390
390
  <tr>
391
391
  <td>Name</td>
392
- <td>get() </td>
392
+ <td>get</td>
393
393
  <td align="center" rowspan="2">none</td>
394
394
  <td rowspan="2">Returns supplied data.</td>
395
395
  </tr>
396
396
  <tr>
397
397
  <td>Aliases</td>
398
- <td>return()</td>
398
+ <td>return, data</td>
399
399
  </tr>
400
400
  <tr>
401
401
  <td>Name</td>
@@ -547,10 +547,14 @@ Common functions for setup, movement, manipulation and math shared by both.
547
547
  <td >Removes and returns data. <br><b>Note:</b> Errors on strict mode</td>
548
548
  </tr>
549
549
  <tr>
550
- <td>Preset</td>
551
- <td>clip()<br>trim()</td>
552
- <td align="center">None</td>
553
- <td >Removes data after the current byte position and returns data. <br><b>Note:</b> Errors on strict mode</td>
550
+ <td>Name</td>
551
+ <td>clip()</td>
552
+ <td align="center" rowspan="2">None</td>
553
+ <td rowspan="2">Removes data after the current byte position and returns data. <br><b>Note:</b> Errors on strict mode</td>
554
+ </tr>
555
+ <tr>
556
+ <td>Alias</td>
557
+ <td>trim()</td>
554
558
  </tr>
555
559
  <tr>
556
560
  <td>Name</td>
@@ -570,7 +574,7 @@ Common functions for setup, movement, manipulation and math shared by both.
570
574
  </tr>
571
575
  <tr>
572
576
  <td>Alias</td>
573
- <td>overwrite(<b>data</b>, consume, offset)</td>
577
+ <td>writeBytes(values, unsigned), overwrite(<b>data</b>, consume, offset)</td>
574
578
  </tr>
575
579
  <tr>
576
580
  <td>Name</td>
@@ -590,7 +594,7 @@ Common functions for setup, movement, manipulation and math shared by both.
590
594
  </tr>
591
595
  <tr>
592
596
  <td>Aliases</td>
593
- <td>slice(<b>length</b>, consume)<br>wrap(<b>length</b>, consume)</td>
597
+ <td>readbytes(amount, unsigned), slice(<b>length</b>, consume)<br>wrap(<b>length</b>, consume)</td>
594
598
  </tr>
595
599
  <tr>
596
600
  <td>Name</td>
@@ -714,13 +718,13 @@ Common functions for setup, movement, manipulation and math shared by both.
714
718
 
715
719
  Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be signed or unsigned (with a ``u`` at the start) and in little or big endian order (``be`` or ``le`` at the end).
716
720
 
717
- **Note:** Remaining bits are dropped when returning to a byte read. Example, after using ``bit4()`` then ``ubyte()``, the read locations drops the remaining 4 bits after ``bit4()`` when reading ``ubyte()``. Any bit reading under 8 will always be unsigned.
721
+ **Note:** Remaining bits are dropped when returning to a byte read. Example, after using ``bit4`` then ``ubyte``, the read locations drops the remaining 4 bits after ``bit4`` when reading ``ubyte``. Any bit reading under 8 will always be unsigned.
718
722
 
719
723
  <table>
720
724
  <thead>
721
725
  <tr>
722
726
  <th></th>
723
- <th align="center">Functions</th>
727
+ <th align="center">Properties</th>
724
728
  <th align="left">Params (bold requires)</th>
725
729
  </tr>
726
730
  </thead>
@@ -736,13 +740,13 @@ Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be
736
740
  </tr>
737
741
  <tr>
738
742
  <td align="center"><b>Presets (reader)</b></td>
739
- <td>[u]bit{1-32}{le|be}(*unsigned)</td>
740
- <td>If value is signed or not.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>first</i> augment</td>
743
+ <td>[u]bit{1-32}{le|be}</td>
744
+ <td>*Note: in BiReader these are get, not functions.</td>
741
745
  </tr>
742
746
  <tr>
743
747
  <td align="center"><b>Presets (writer)</b></td>
744
- <td>[u]bit{1-32}{le|be}(<b>value</b>, *unsigned)</td>
745
- <td><b>value to write</b>, if value is unsigned or not.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>fourth</i> augment</td>
748
+ <td>[u]bit{1-32}{le|be} = <b>value</b></td>
749
+ <td>*Note: in BiWriter these are set, not functions.</td>
746
750
  </tr>
747
751
  </tbody>
748
752
  </table>
@@ -755,7 +759,7 @@ Parse value as a byte (aka int8). Can be signed or unsigned (with a ``u`` at the
755
759
  <thead>
756
760
  <tr>
757
761
  <th></th>
758
- <th align="center">Functions</th>
762
+ <th align="center">Properties</th>
759
763
  <th align="left">Params (bold requires)</th>
760
764
  </tr>
761
765
  </thead>
@@ -771,13 +775,13 @@ Parse value as a byte (aka int8). Can be signed or unsigned (with a ``u`` at the
771
775
  </tr>
772
776
  <tr>
773
777
  <td align="center"><b>Presets (reader)</b></td>
774
- <td>[u]{byte|int8}(*unsigned)</td>
775
- <td>If value is signed or not.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>first</i> augment</td>
778
+ <td>[u]{byte|int8}</td>
779
+ <td>*Note: in BiReader these are get, not functions.</td>
776
780
  </tr>
777
781
  <tr>
778
782
  <td align="center"><b>Presets (writer)</b></td>
779
- <td>[u]{byte|int8}(<b>value</b>, *unsigned)</td>
780
- <td><b>value to write</b>, if value is signed or not.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>third</i> augment</td>
783
+ <td>[u]{byte|int8} = <b>value</b></td>
784
+ <td>*Note: in BiWriter these are set, not functions.</td>
781
785
  </tr>
782
786
  </tbody>
783
787
  </table>
@@ -790,7 +794,7 @@ Parse value as a int16 (aka short or word). Can be signed or unsigned (with a ``
790
794
  <thead>
791
795
  <tr>
792
796
  <th></th>
793
- <th align="center">Functions</th>
797
+ <th align="center">Properties</th>
794
798
  <th align="left">Params (bold requires)</th>
795
799
  </tr>
796
800
  </thead>
@@ -806,13 +810,13 @@ Parse value as a int16 (aka short or word). Can be signed or unsigned (with a ``
806
810
  </tr>
807
811
  <tr>
808
812
  <td align="center"><b>Presets (reader)</b></td>
809
- <td>[u]{int16|word|short}{be|le}(*unsigned, *endian)</td>
810
- <td>If value is unsigned, big or little endian.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>first</i> augment, and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>second</i> augment (does not overwite set endian).</td>
813
+ <td>[u]{int16|word|short}{be|le}</td>
814
+ <td>*Note: in BiReader these are get, not functions.</td>
811
815
  </tr>
812
816
  <tr>
813
817
  <td align="center"><b>Presets (writer)</b></td>
814
- <td>[u]{int16|word|short}{be|le}(<b>value</b>, *unsigned, *endian)</td>
815
- <td><b>value to write</b>, if value is unsigned, big or little endian.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>third</i> augment, and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>fourth</i> augment (does not overwite set endian).</td>
818
+ <td>[u]{int16|word|short}{be|le} = <b>value</b></td>
819
+ <td>*Note: in BiWriter these are set, not functions.</td>
816
820
  </tr>
817
821
  </tbody>
818
822
  </table>
@@ -825,7 +829,7 @@ Parse value as a half float (aka half). Can be in little or big endian order (``
825
829
  <thead>
826
830
  <tr>
827
831
  <th></th>
828
- <th align="center">Functions</th>
832
+ <th align="center">Properties</th>
829
833
  <th align="left">Params (bold requires)</th>
830
834
  </tr>
831
835
  </thead>
@@ -841,13 +845,13 @@ Parse value as a half float (aka half). Can be in little or big endian order (``
841
845
  </tr>
842
846
  <tr>
843
847
  <td align="center"><b>Presets (reader)</b></td>
844
- <td>{halffloat|half}{be|le}(*endian)</td>
845
- <td>Big or little endian.<br>*Note: functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>first</i> augment (does not overwite set endian).</td>
848
+ <td>{halffloat|half}{be|le}</td>
849
+ <td>*Note: in BiReader these are get, not functions.</td>
846
850
  </tr>
847
851
  <tr>
848
852
  <td align="center"><b>Presets (writer)</b></td>
849
- <td>{halffloat|half}{be|le}(<b>value</b>, *endian)</td>
850
- <td><b>value to write</b>, big or little endian.<br>*Note: and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>second</i> augment (does not overwite set endian).</td>
853
+ <td>{halffloat|half}{be|le} = <b>value</b></td>
854
+ <td>*Note: in BiWriter these are set, not functions.</td>
851
855
  </tr>
852
856
  </tbody>
853
857
  </table>
@@ -860,7 +864,7 @@ Parse value as a int32 (aka int, long or double). Can be signed or unsigned (wi
860
864
  <thead>
861
865
  <tr>
862
866
  <th></th>
863
- <th align="center">Functions</th>
867
+ <th align="center">Properties</th>
864
868
  <th align="left">Params (bold requires)</th>
865
869
  </tr>
866
870
  </thead>
@@ -876,13 +880,13 @@ Parse value as a int32 (aka int, long or double). Can be signed or unsigned (wi
876
880
  </tr>
877
881
  <tr>
878
882
  <td align="center"><b>Presets (reader)</b></td>
879
- <td>[u]{int32|long|int|double}{be|le}(*unsigned, *endian)</td>
880
- <td>If value is unsigned, little or big endian.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>first</i> augment, and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>second</i> augment (does not overwite set endian).</td>
883
+ <td>[u]{int32|long|int|double}{be|le}</td>
884
+ <td>*Note: in BiReader these are get, not functions.</td>
881
885
  </tr>
882
886
  <tr>
883
887
  <td align="center"><b>Presets (writer)</b></td>
884
- <td>[u]{int32|long|int|double}{be|le}(<b>value</b>, *unsigned, *endian)</td>
885
- <td><b>value to write</b>, if value is unsigned, little or big endian<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>third</i> augment, and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>fourth</i> augment (does not overwite set endian).</td>
888
+ <td>[u]{int32|long|int|double}{be|le} = <b>value</b></td>
889
+ <td>*Note: in BiWriter these are set, not functions.</td>
886
890
  </tr>
887
891
  </tbody>
888
892
  </table>
@@ -895,7 +899,7 @@ Parse value as a float. Can be in little or big endian order (``be`` or ``le`` a
895
899
  <thead>
896
900
  <tr>
897
901
  <th></th>
898
- <th align="center">Functions</th>
902
+ <th align="center">Properties</th>
899
903
  <th align="left">Params (bold requires)</th>
900
904
  </tr>
901
905
  </thead>
@@ -911,13 +915,13 @@ Parse value as a float. Can be in little or big endian order (``be`` or ``le`` a
911
915
  </tr>
912
916
  <tr>
913
917
  <td align="center"><b>Presets (reader)</b></td>
914
- <td>float{be|le}(*endian)</td>
915
- <td>Big or little endian.<br>*Note: functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>first</i> augment (does not overwite set endian).</td>
918
+ <td>float{be|le}</td>
919
+ <td>*Note: in BiReader these are get, not functions.</td>
916
920
  </tr>
917
921
  <tr>
918
922
  <td align="center"><b>Presets (writer)</b></td>
919
- <td>float{be|le}(<b>value</b>, *endian)</td>
920
- <td><b>value to write</b>, big or little endian.<br>*Note: functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>third</i> augment (does not overwite set endian).</td>
923
+ <td>float{be|le} = <b>value</b></td>
924
+ <td>*Note: in BiWriter these are set, not functions.</td>
921
925
  </tr>
922
926
  </tbody>
923
927
  </table>
@@ -930,7 +934,7 @@ Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `
930
934
  <thead>
931
935
  <tr>
932
936
  <th></th>
933
- <th align="center">Functions</th>
937
+ <th align="center">Properties</th>
934
938
  <th align="left">Params (bold requires)</th>
935
939
  </tr>
936
940
  </thead>
@@ -946,13 +950,13 @@ Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `
946
950
  </tr>
947
951
  <tr>
948
952
  <td align="center"><b>Presets (reader)</b></td>
949
- <td>[u]{int64|quad|bigint}{be|le}(*unsigned, *endian)</td>
950
- <td>If value is unsigned, if value is unsigned, big or little endian.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>first</i> augment, and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>second</i> augment (does not overwite set endian).</td>
953
+ <td>[u]{int64|quad|bigint}{be|le}</td>
954
+ <td>If value is unsigned, if value is unsigned, big or little endian.<br>*Note: in BiReader these are get, not functions.</td>
951
955
  </tr>
952
956
  <tr>
953
957
  <td align="center"><b>Presets (writer)</b></td>
954
- <td>[u]{int64|quad|bigint}{be|le}(<b>value</b>, *unsigned, *endian)</td>
955
- <td><b>value to write</b>, if value is unsigned, big or little endian.<br>*Note: functions without the starting letter <u>u</u> can still be called unsigned when <b>true</b> is the <i>third</i> augment, and functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>fourth</i> augment (does not overwite set endian).</td>
958
+ <td>[u]{int64|quad|bigint}{be|le} = <b>value</b></td>
959
+ <td><b>value to write</b>, if value is unsigned, big or little endian.<br>*Note: in BiWriter these are set, not functions.</td>
956
960
  </tr>
957
961
  </tbody>
958
962
  </table>
@@ -965,7 +969,7 @@ Parse value as a double float (aka dfloat). Can be in little or big endian order
965
969
  <thead>
966
970
  <tr>
967
971
  <th></th>
968
- <th align="center">Functions</th>
972
+ <th align="center">Properties</th>
969
973
  <th align="left">Params (bold requires)</th>
970
974
  </tr>
971
975
  </thead>
@@ -981,13 +985,13 @@ Parse value as a double float (aka dfloat). Can be in little or big endian order
981
985
  </tr>
982
986
  <tr>
983
987
  <td align="center"><b>Presets (reader)</b></td>
984
- <td>{doublefloat|dfloat}{be|le}(*endian)</td>
985
- <td>Big or little endian.<br>*Note: functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>first</i> augment (does not overwite set endian).</td>
988
+ <td>{doublefloat|dfloat}{be|le}</td>
989
+ <td>*Note: in BiReader these are get, not functions.</td>
986
990
  </tr>
987
991
  <tr>
988
992
  <td align="center"><b>Presets (writer)</b></td>
989
- <td>{doublefloat|dfloat}{be|le}(<b>value</b>, *endian)</td>
990
- <td><b>Value to write</b>, big or little endian.<br>*Note: functions without ending letters <u>be</u> or <u>le</u> can still be called the endian in the <i>third</i> augment (does not overwite set endian).</td>
993
+ <td>{doublefloat|dfloat}{be|le} = <b>value</b></td>
994
+ <td>*Note: in BiWriter these are set, not functions.</td>
991
995
  </tr>
992
996
  </tbody>
993
997
  </table>