bireader 1.0.14 → 1.0.17
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 +492 -247
- package/lib/cjs/src/common.js +1299 -0
- package/lib/cjs/src/common.js.map +1 -0
- package/lib/cjs/src/reader.js +729 -692
- package/lib/cjs/src/reader.js.map +1 -1
- package/lib/cjs/src/writer.js +2210 -2570
- package/lib/cjs/src/writer.js.map +1 -1
- package/lib/cjs/types/src/common.d.ts +56 -0
- package/lib/cjs/types/src/common.d.ts.map +1 -0
- package/lib/cjs/types/src/reader.d.ts +466 -120
- package/lib/cjs/types/src/reader.d.ts.map +1 -1
- package/lib/cjs/types/src/writer.d.ts +1565 -1493
- package/lib/cjs/types/src/writer.d.ts.map +1 -1
- package/lib/esm/src/common.js +1262 -0
- package/lib/esm/src/common.js.map +1 -0
- package/lib/esm/src/reader.js +729 -692
- package/lib/esm/src/reader.js.map +1 -1
- package/lib/esm/src/writer.js +2210 -2570
- package/lib/esm/src/writer.js.map +1 -1
- package/lib/esm/types/src/common.d.ts +56 -0
- package/lib/esm/types/src/common.d.ts.map +1 -0
- package/lib/esm/types/src/reader.d.ts +466 -120
- package/lib/esm/types/src/reader.d.ts.map +1 -1
- package/lib/esm/types/src/writer.d.ts +1565 -1493
- package/lib/esm/types/src/writer.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# bireader
|
|
2
2
|
|
|
3
|
-
A
|
|
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
|
|
|
5
5
|
Supported data types are:
|
|
6
6
|
|
|
@@ -29,313 +29,558 @@ Includes presents for quick parsing or programmable functions (examples below).
|
|
|
29
29
|
```javascript
|
|
30
30
|
import {bireader, biwriter} from 'bireader';
|
|
31
31
|
|
|
32
|
-
//parse a webp file
|
|
32
|
+
//read example - parse a webp file
|
|
33
33
|
function parse_webp(data){
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
34
|
+
const br = new bireader(data)
|
|
35
|
+
br.hexdump({supressUnicode:true}) //console.log data as hex
|
|
36
|
+
|
|
37
|
+
// 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
|
|
38
|
+
// 00000 52 49 46 46 98 3a 00 00 57 45 42 50 56 50 38 58 RIFF.:..WEBPVP8X
|
|
39
|
+
// 00010 0a 00 00 00 10 00 00 00 ff 00 00 ff 00 00 41 4c ..............AL
|
|
40
|
+
// 00020 50 48 26 10 00 00 01 19 45 6d 1b 49 4a 3b cf 0c PH&.....Em.IJ;..
|
|
41
|
+
// 00030 7f c0 7b 60 88 e8 ff 04 80 a2 82 65 56 d2 d2 86 ..{`.......eV...
|
|
42
|
+
// 00040 24 54 61 d0 83 8f 7f 0e 82 b6 6d e3 f0 a7 bd ed $Ta.......m.....
|
|
43
|
+
// 00050 87 10 11 13 40 3b 86 8f 26 4b d6 2a b7 6d 24 39 ....@;..&K.*.m$9
|
|
44
|
+
// 00060 52 4f fe 39 7f 3b 62 4e cc ec 9b 17 31 01 0c 24 RO.9.;bN....1..$
|
|
45
|
+
// 00070 49 89 23 e0 01 ab 52 64 e3 23 fc 61 db 76 cc 91 I.#...Rd.#.a.v..
|
|
46
|
+
// 00080 b6 7d fb 51 48 c5 69 db 4c 1b 63 db b6 ed b9 6d .}.QH.i.L.c....m
|
|
47
|
+
// 00090 db be 87 8d b1 6d db 9e b6 cd a4 d3 ee 24 95 54 .....m.......$.T
|
|
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
|
+
// 000b0 77 44 40 94 6d 25 6c 74 91 a8 88 86 58 9b da 6e wD@.m%lt....X..n
|
|
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
|
|
58
|
+
switch (header.format){
|
|
59
|
+
case "VP8 ":
|
|
60
|
+
header.formatType = "Lossy"
|
|
61
|
+
var read_size = 0
|
|
62
|
+
header.frame_tag = br.ubit24()
|
|
63
|
+
read_size += 3;
|
|
64
|
+
header.key_frame = header.frame_tag & 0x1;
|
|
65
|
+
header.version = (header.frame_tag >> 1) & 0x7;
|
|
66
|
+
header.show_frame = (header.frame_tag >> 4) & 0x1;
|
|
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();
|
|
70
|
+
header.width = header.horizontal_size_code & 0x3FFF;
|
|
71
|
+
header.horizontal_scale = header.horizontal_size_code >> 14;
|
|
72
|
+
header.vertical_size_code = br.ubit16();
|
|
73
|
+
header.height = header.vertical_size_code & 0x3FFF;
|
|
74
|
+
header.vertical_scale = header.vertical_size_code >> 14;
|
|
75
|
+
read_size += 7;
|
|
76
|
+
header.VP8data = br.extract(header.formatChunkSize - read_size, true)
|
|
77
|
+
break;
|
|
78
|
+
case "VP8L":
|
|
79
|
+
header.formatType = "Lossless"
|
|
80
|
+
var read_size = 0
|
|
81
|
+
header.signature = br.ubyte() //should be 47
|
|
82
|
+
read_size += 1;
|
|
83
|
+
header.readWidth = br.ubit14()
|
|
84
|
+
header.width = header.readWidth+1;
|
|
85
|
+
header.readHeight = br.ubit14()
|
|
86
|
+
header.height = header.readHeight+1;
|
|
87
|
+
header.alpha_is_used = br.bit1()
|
|
88
|
+
header.version_number = br.ubit3()
|
|
89
|
+
read_size += 4;
|
|
90
|
+
header.VP8Ldata = br.extract(header.formatChunkSize - read_size, true)
|
|
91
|
+
break;
|
|
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()
|
|
105
|
+
header.width = header.widthMinus1 + 1
|
|
106
|
+
header.heightMinus1 = br.ubit24()
|
|
107
|
+
header.height = header.heightMinus1 + 1
|
|
108
|
+
if(header.I)
|
|
109
|
+
{
|
|
110
|
+
header.ICCP = br.string({length:4}) // Should be ICCP
|
|
111
|
+
header.ICCPChunkSize = br.uint32()
|
|
112
|
+
header.ICCPData = br.extract(header.ICCPChunkSize, true)
|
|
113
|
+
}
|
|
114
|
+
if(header.L)
|
|
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)
|
|
119
|
+
}
|
|
120
|
+
if(header.A)
|
|
121
|
+
{
|
|
122
|
+
header.ANI = br.string({length:4}) // Should be ANIM or ANIF
|
|
123
|
+
header.ANIChunkSize = br.uint32()
|
|
124
|
+
if(header.ANI == "ANIM")
|
|
109
125
|
{
|
|
110
|
-
header.
|
|
111
|
-
header.
|
|
112
|
-
header.
|
|
113
|
-
}
|
|
114
|
-
if(header.
|
|
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)
|
|
119
|
-
}
|
|
120
|
-
if(header.A)
|
|
121
|
-
{
|
|
122
|
-
header.ANI = br.string({length:4}) // Should be ANIM or ANIF
|
|
123
|
-
header.ANIChunkSize = br.uint32()
|
|
124
|
-
if(header.ANI == "ANIM")
|
|
125
|
-
{
|
|
126
|
-
header.BGColor = br.uint32()
|
|
127
|
-
header.loopCount = br.ushort()
|
|
128
|
-
header.ANIMData = br.extract(header.ANIChunkSize, true)
|
|
129
|
-
} else
|
|
130
|
-
if (header.ANI == "ANIF")
|
|
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)
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
header.extFormatStr = br.string({length:4})
|
|
147
|
-
header.extChunkSize = br.uint32()
|
|
148
|
-
header.extData = br.extract(header.extChunkSize, true)
|
|
149
|
-
if(header.E)
|
|
150
|
-
{
|
|
151
|
-
header.EXIF = br.string({length:4}) // Should be EXIF
|
|
152
|
-
header.EXIFChunkSize = br.uint32()
|
|
153
|
-
header.EXIFData = br.extract(header.EXIFChunkSize, true)
|
|
154
|
-
}
|
|
155
|
-
if(header.X)
|
|
126
|
+
header.BGColor = br.uint32()
|
|
127
|
+
header.loopCount = br.ushort()
|
|
128
|
+
header.ANIMData = br.extract(header.ANIChunkSize, true)
|
|
129
|
+
} else
|
|
130
|
+
if (header.ANI == "ANIF")
|
|
156
131
|
{
|
|
157
|
-
header.
|
|
158
|
-
header.
|
|
159
|
-
header.
|
|
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)
|
|
160
144
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
145
|
+
}
|
|
146
|
+
header.extFormatStr = br.string({length:4})
|
|
147
|
+
header.extChunkSize = br.uint32()
|
|
148
|
+
header.extData = br.extract(header.extChunkSize, true)
|
|
149
|
+
if(header.E)
|
|
150
|
+
{
|
|
151
|
+
header.EXIF = br.string({length:4}) // Should be EXIF
|
|
152
|
+
header.EXIFChunkSize = br.uint32()
|
|
153
|
+
header.EXIFData = br.extract(header.EXIFChunkSize, true)
|
|
154
|
+
}
|
|
155
|
+
if(header.X)
|
|
156
|
+
{
|
|
157
|
+
header.XMP = br.string({length:4}) // Should be XMP
|
|
158
|
+
header.XMPChunkSize = br.uint32()
|
|
159
|
+
header.XMPMetaData = br.extract(header.XMPChunkSize, true)
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
header.data = br.extract(header.formatChunkSize, true)
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
br.finished()
|
|
167
|
+
return header
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
bw.
|
|
179
|
-
bw.
|
|
180
|
-
|
|
181
|
-
bw.
|
|
182
|
-
bw.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
bw.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
170
|
+
//write example - write a webp file from read data
|
|
171
|
+
function write_webp(data){
|
|
172
|
+
const bw = new biwriter(new Uint8Arry(1)) //extends array as we write 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
|
+
switch(data.format){
|
|
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)
|
|
185
|
+
break;
|
|
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)
|
|
195
|
+
break;
|
|
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)
|
|
211
|
+
if(data.I)
|
|
212
|
+
{
|
|
213
|
+
bw.string(data.ICCP, {length:4})
|
|
214
|
+
bw.uint32(data.ICCPData.length)
|
|
215
|
+
bw.replace(data.ICCPData, true)
|
|
216
|
+
}
|
|
217
|
+
if(data.L)
|
|
218
|
+
{
|
|
219
|
+
bw.string(data.ALPH, {length:4})
|
|
220
|
+
bw.uint32(data.ALPHData.length)
|
|
221
|
+
bw.replace(data.ALPHData)
|
|
222
|
+
}
|
|
223
|
+
if(data.A)
|
|
224
|
+
{
|
|
225
|
+
bw.string(data.ANI, {length:4})
|
|
226
|
+
bw.uint32(data.ANIChunkSize)
|
|
227
|
+
if(data.ANI == "ANIM")
|
|
228
|
+
{
|
|
229
|
+
bw.uint32(data.BGColor)
|
|
230
|
+
bw.ushort(data.loopCount)
|
|
231
|
+
bw.replace(data.ANIMData)
|
|
232
|
+
} else
|
|
233
|
+
if (data.ANI == "ANIF")
|
|
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)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
bw.string(data.extFormatStr, {length:4})
|
|
248
|
+
bw.uint32(data.extData.length)
|
|
249
|
+
bw.replace(data.extData, true)
|
|
250
|
+
if(data.E)
|
|
251
|
+
{
|
|
252
|
+
bw.string(data.EXIF, {length:4})
|
|
253
|
+
bw.uint32(data.EXIFData.length)
|
|
254
|
+
bw.replace( data.EXIFData, true)
|
|
255
|
+
}
|
|
256
|
+
if(data.X)
|
|
257
|
+
{
|
|
258
|
+
bw.string(data.XMP, {length:4})
|
|
259
|
+
bw.uint32(data.XMPMetaData.length)
|
|
260
|
+
bw.replace(data.XMPMetaData, true)
|
|
261
|
+
}
|
|
262
|
+
break;
|
|
263
|
+
default:
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
bw.goto(4)
|
|
267
|
+
bw.uint32le(bw.size - 8) //write file size
|
|
268
|
+
return bw.return()
|
|
194
269
|
}
|
|
195
270
|
```
|
|
196
271
|
|
|
197
272
|
## Common Functions
|
|
198
273
|
|
|
199
|
-
Common functions for setup and
|
|
274
|
+
Common functions for setup, movement, manipulation and math shared by both.
|
|
200
275
|
|
|
201
276
|
<table>
|
|
202
277
|
<thead>
|
|
203
278
|
<tr>
|
|
204
279
|
<th align="center" colspan="2">Function</th>
|
|
205
280
|
<th align="center">Params (bold requires)</th>
|
|
206
|
-
<th align="left">
|
|
281
|
+
<th align="left">Desc</th>
|
|
207
282
|
</tr>
|
|
208
283
|
</thead>
|
|
209
284
|
<tbody>
|
|
285
|
+
<tr>
|
|
286
|
+
<th align="center" colspan="4"><i>Setup</i></th>
|
|
287
|
+
<tr>
|
|
210
288
|
<tr>
|
|
211
289
|
<td>Name</td>
|
|
212
|
-
<td>new bireader(<b>data</b>,
|
|
213
|
-
<td align="center" rowspan="2"><b>Buffer or Uint8Array</b>, byte offset, bit offset, endian</td>
|
|
214
|
-
<td rowspan="2">new Constructor</td>
|
|
290
|
+
<td>new bireader(<b>data</b>, byteOffset, bitOffset, endianess, strict)</td>
|
|
291
|
+
<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)</td>
|
|
292
|
+
<td rowspan="2">Start with new Constructor.<br><b>Note:</b> Data can always be found with .data</td>
|
|
215
293
|
</tr>
|
|
216
294
|
<tr>
|
|
217
295
|
<td>Name</td>
|
|
218
|
-
<td>new biwriter(<b>data</b>,
|
|
296
|
+
<td>new biwriter(<b>data</b>, byteOffset, bitOffset, endianess, strict)</td>
|
|
219
297
|
</tr>
|
|
220
298
|
<tr>
|
|
221
299
|
<td>Name</td>
|
|
222
|
-
<td>endianness(<b>
|
|
300
|
+
<td>endianness(<b>bigOrLittle</b>)</td>
|
|
223
301
|
<td align="center" rowspan="2"><b>big</b> or <b>little</b> (default little)</td>
|
|
224
|
-
<td rowspan="2">Can be changed at any time.</td>
|
|
302
|
+
<td rowspan="2">Set or change Endian. Can be changed at any time.</td>
|
|
225
303
|
</tr>
|
|
226
304
|
<tr>
|
|
227
305
|
<td>Presets</td>
|
|
228
|
-
<td>bigEndian()
|
|
306
|
+
<td>bigEndian(), big(), be()<br>littleEndian(), little(), le()</td>
|
|
229
307
|
</tr>
|
|
230
308
|
<tr>
|
|
231
309
|
<td>Name</td>
|
|
232
|
-
<td>
|
|
233
|
-
<td align="center" rowspan="2"
|
|
234
|
-
<td rowspan="2">
|
|
310
|
+
<td>getOffset()</td>
|
|
311
|
+
<td align="center" rowspan="2">none</td>
|
|
312
|
+
<td rowspan="2">Gets current byte position.</td>
|
|
235
313
|
</tr>
|
|
236
314
|
<tr>
|
|
237
315
|
<td>Aliases</td>
|
|
238
|
-
<td>
|
|
316
|
+
<td>tell(), saveOffset()</td>
|
|
239
317
|
</tr>
|
|
240
318
|
<tr>
|
|
241
319
|
<td>Name</td>
|
|
242
|
-
<td>
|
|
243
|
-
<td align="center" rowspan="2"
|
|
244
|
-
<td rowspan="2"
|
|
320
|
+
<td>getOffsetBit()</td>
|
|
321
|
+
<td align="center" rowspan="2">none</td>
|
|
322
|
+
<td rowspan="2">Gets current bit position (0-7).</td>
|
|
245
323
|
</tr>
|
|
246
324
|
<tr>
|
|
247
325
|
<td>Aliases</td>
|
|
248
|
-
<td>
|
|
326
|
+
<td>tellB(), saveOffsetBit()</td>
|
|
249
327
|
</tr>
|
|
250
328
|
<tr>
|
|
251
329
|
<td>Name</td>
|
|
252
|
-
<td>
|
|
330
|
+
<td>getOffsetAbsBit()</td>
|
|
253
331
|
<td align="center" rowspan="2">none</td>
|
|
254
|
-
<td rowspan="2">
|
|
332
|
+
<td rowspan="2">Gets current absolute bit position from start of data.</td>
|
|
255
333
|
</tr>
|
|
256
334
|
<tr>
|
|
257
335
|
<td>Aliases</td>
|
|
258
|
-
<td>
|
|
336
|
+
<td>tellAbsB(), saveOffsetAbsBit()</td>
|
|
259
337
|
</tr>
|
|
260
338
|
<tr>
|
|
261
339
|
<td>Name</td>
|
|
262
|
-
<td>
|
|
340
|
+
<td>get() </td>
|
|
263
341
|
<td align="center" rowspan="2">none</td>
|
|
264
|
-
<td rowspan="2">
|
|
342
|
+
<td rowspan="2">Returns supplied data.</td>
|
|
265
343
|
</tr>
|
|
266
344
|
<tr>
|
|
267
345
|
<td>Aliases</td>
|
|
268
|
-
<td>
|
|
346
|
+
<td>return()</td>
|
|
347
|
+
</tr>
|
|
348
|
+
<tr>
|
|
349
|
+
<td>Name</td>
|
|
350
|
+
<td>hexdump({length, startByte, supressUnicode})</td>
|
|
351
|
+
<td align="center">Length of dump in bytes (default 192), byte position to start the dump (default current byte position), supress unicode character preview for cleaner columns (default false)</td>
|
|
352
|
+
<td >Console logs data. Will trigger on error unless turned off (see below)</td>
|
|
353
|
+
</tr>
|
|
354
|
+
<tr>
|
|
355
|
+
<td>Name</td>
|
|
356
|
+
<td>errorDumpOff()</td>
|
|
357
|
+
<td align="center">None</td>
|
|
358
|
+
<td >Does not hexdump on error (default true)</td>
|
|
359
|
+
</tr>
|
|
360
|
+
<tr>
|
|
361
|
+
<td>Name</td>
|
|
362
|
+
<td>errorDumpOn()</td>
|
|
363
|
+
<td align="center">None</td>
|
|
364
|
+
<td >Will hexdump on error (default true)</td>
|
|
269
365
|
</tr>
|
|
270
366
|
<tr>
|
|
271
367
|
<td>Name</td>
|
|
272
368
|
<td>unrestrict()</td>
|
|
273
369
|
<td align="center">none</td>
|
|
274
|
-
<td
|
|
370
|
+
<td>Sets strict mode to false, will extend array if data is outside of max size (<b>default true for reader, false for writer</b>)</td>
|
|
275
371
|
</tr>
|
|
276
372
|
<tr>
|
|
277
373
|
<td>Name</td>
|
|
278
374
|
<td>restrict()</td>
|
|
279
375
|
<td align="center">none</td>
|
|
280
|
-
<td
|
|
376
|
+
<td>Sets strict mode to true, won't extend array if data is outside of max size (<b>default true for reader, false for writer</b>)</td>
|
|
281
377
|
</tr>
|
|
282
378
|
<tr>
|
|
283
379
|
<td>Name</td>
|
|
284
|
-
<td>
|
|
285
|
-
<td align="center" rowspan="2">
|
|
286
|
-
<td rowspan="2">
|
|
380
|
+
<td>end()</td>
|
|
381
|
+
<td align="center" rowspan="2">none</td>
|
|
382
|
+
<td rowspan="2">Removes supplied data.</td>
|
|
287
383
|
</tr>
|
|
288
384
|
<tr>
|
|
289
385
|
<td>Aliases</td>
|
|
290
|
-
<td>
|
|
386
|
+
<td>close(), done(), finished()</td>
|
|
291
387
|
</tr>
|
|
292
|
-
|
|
388
|
+
<th align="center" colspan="4"><i>Movement</i></th>
|
|
389
|
+
<tr>
|
|
293
390
|
<td>Name</td>
|
|
294
|
-
<td>
|
|
295
|
-
<td align="center" rowspan="2"><b>
|
|
296
|
-
<td rowspan="2">
|
|
391
|
+
<td>skip(<b>bytes</b>, bits)</td>
|
|
392
|
+
<td align="center" rowspan="2"><b>Bytes to skip from current byte position</b>, bits to skip (default 0)</td>
|
|
393
|
+
<td rowspan="2">Use negative to go back.<br><b>Note:</b> Remaining bits are dropped when returning to a byte function.</td>
|
|
394
|
+
</tr>
|
|
395
|
+
<tr>
|
|
396
|
+
<td>Alias</td>
|
|
397
|
+
<td>jump(<b>bytes</b>, bits)</td>
|
|
398
|
+
</tr>
|
|
399
|
+
<tr>
|
|
400
|
+
<td>Name</td>
|
|
401
|
+
<td>goto(<b>byte</b>, bit)</td>
|
|
402
|
+
<td align="center" rowspan="2"><b>Byte offset from start</b>, bit offset from byte offset</td>
|
|
403
|
+
<td rowspan="2"><b>Note:</b> Remaining bits are drop when returning to byte function.</td>
|
|
297
404
|
</tr>
|
|
298
405
|
<tr>
|
|
299
406
|
<td>Aliases</td>
|
|
300
|
-
<td>
|
|
407
|
+
<td>seek(<b>byte</b>, bit)<br>pointer(<b>byte</b>, bit)<br>warp(<b>byte</b>, bit)</td>
|
|
301
408
|
</tr>
|
|
302
409
|
<tr>
|
|
303
410
|
<td>Name</td>
|
|
304
|
-
<td>
|
|
411
|
+
<td>rewind()</td>
|
|
305
412
|
<td align="center" rowspan="2">none</td>
|
|
306
|
-
<td rowspan="2">
|
|
413
|
+
<td rowspan="2">Moves current byte position to start of data.</td>
|
|
414
|
+
</tr>
|
|
415
|
+
<tr>
|
|
416
|
+
<td>Alias</td>
|
|
417
|
+
<td>gotostart()</td>
|
|
418
|
+
</tr>
|
|
419
|
+
<th align="center" colspan="4"><i>Manipulation</i></th>
|
|
420
|
+
<tr>
|
|
421
|
+
<td>Name</td>
|
|
422
|
+
<td>delete(startOffset, endOffset, consume)</td>
|
|
423
|
+
<td align="center" rowspan="2">Start byte of data (default 0), end byte of data (default current byte position), move byte position to after data read (default false)</td>
|
|
424
|
+
<td rowspan="2">Removes and returns data. <br><b>Note:</b> Errors on strict mode</td>
|
|
425
|
+
</tr>
|
|
426
|
+
<tr>
|
|
427
|
+
<td>Alias</td>
|
|
428
|
+
<td>clip(startOffset, endOffset, consume)</td>
|
|
429
|
+
</tr>
|
|
430
|
+
<tr>
|
|
431
|
+
<td>Name</td>
|
|
432
|
+
<td>crop(<b>length</b>, consume)</td>
|
|
433
|
+
<td align="center" rowspan="2"><b>Number of bytes to read and remove from current byte position</b>, move byte position to after data read (default false)</td>
|
|
434
|
+
<td rowspan="2">Removes and returns data from current byte position for length of data</b>.<br><b>Note:</b> Errors on strict mode</td>
|
|
435
|
+
</tr>
|
|
436
|
+
<tr>
|
|
437
|
+
<td>Alias</td>
|
|
438
|
+
<td>drop(<b>length</b>, consume)</td>
|
|
439
|
+
</tr>
|
|
440
|
+
<tr>
|
|
441
|
+
<td>Name</td>
|
|
442
|
+
<td>replace(<b>data</b>, consume, offset)</td>
|
|
443
|
+
<td align="center" rowspan="2"><b>Data to replace in supplied data</b>, move byte position to after data read (default false), byte position to start replace (default current byte position)</td>
|
|
444
|
+
<td rowspan="2">Replaces data at current byte or supplied offset.<br><b>Note:</b> Errors on strict mode</td>
|
|
445
|
+
</tr>
|
|
446
|
+
<tr>
|
|
447
|
+
<td>Alias</td>
|
|
448
|
+
<td>overwrite(<b>data</b>, consume, offset)</td>
|
|
449
|
+
</tr>
|
|
450
|
+
<tr>
|
|
451
|
+
<td>Name</td>
|
|
452
|
+
<td>lift(startByte, endByte, consume, fillValue)</td>
|
|
453
|
+
<td align="center" rowspan="2">Start of byte read (default current byte position), end of byte read (default end of data), move current byte position to end of byte read (default false), value to fill bytes (will <b>NOT</b> fill on default)</td>
|
|
454
|
+
<td rowspan="2">Returns data from supplied byte positions. <br><b>Note:</b> Only moves current byte position if consume is true. Only fills data if value is supplied</td>
|
|
307
455
|
</tr>
|
|
308
456
|
<tr>
|
|
309
457
|
<td>Aliases</td>
|
|
310
|
-
<td>
|
|
458
|
+
<td>fill(startByte, endByte, consume, fillValue)</td>
|
|
311
459
|
</tr>
|
|
312
460
|
<tr>
|
|
313
461
|
<td>Name</td>
|
|
314
|
-
<td>
|
|
315
|
-
<td align="center" rowspan="2">
|
|
316
|
-
<td rowspan="2">
|
|
462
|
+
<td>extract(<b>length</b>, consume)</td>
|
|
463
|
+
<td align="center" rowspan="2"><b>Number of bytes to read</b>, move byte position to after data read (default false)</td>
|
|
464
|
+
<td rowspan="2">Returns data from current byte position for length of data</b>.</td>
|
|
465
|
+
</tr>
|
|
466
|
+
<tr>
|
|
467
|
+
<td>Aliases</td>
|
|
468
|
+
<td>slice(<b>length</b>, consume)<br>wrap(<b>length</b>, consume)</td>
|
|
469
|
+
</tr>
|
|
470
|
+
<tr>
|
|
471
|
+
<td>Name</td>
|
|
472
|
+
<td>insert(<b>data</b>, consume, offset)</td>
|
|
473
|
+
<td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false), byte position to insert (default current byte position)</td>
|
|
474
|
+
<td rowspan="2">Inserts new data into supplied data. <b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
|
|
475
|
+
</tr>
|
|
476
|
+
<tr>
|
|
477
|
+
<td>Aliases</td>
|
|
478
|
+
<td>place(<b>data</b>, consume, offset)</td>
|
|
479
|
+
</tr>
|
|
480
|
+
<tr>
|
|
481
|
+
<td>Name</td>
|
|
482
|
+
<td>unshift(<b>data</b>, consume)</td>
|
|
483
|
+
<td align="center" rowspan="2"><b>New data to insert</b>, move byte position to after data read (default false)</td>
|
|
484
|
+
<td rowspan="2">Adds new data to start of supplied data<br><b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
|
|
485
|
+
</tr>
|
|
486
|
+
<tr>
|
|
487
|
+
<td>Aliases</td>
|
|
488
|
+
<td>prepend(<b>data</b>, consume)</td>
|
|
489
|
+
</tr>
|
|
490
|
+
<tr>
|
|
491
|
+
<td>Name</td>
|
|
492
|
+
<td>push(<b>length</b>, consume)</td>
|
|
493
|
+
<td align="center" rowspan="2"><b>Number</b>, move byte position to after data read (default false)</td>
|
|
494
|
+
<td rowspan="2">Adds new data to end of supplied data<br><b>Note:</b> Data type must match supplied data. Errors on strict mode</td>
|
|
317
495
|
</tr>
|
|
318
496
|
<tr>
|
|
319
497
|
<td>Aliases</td>
|
|
320
|
-
<td>
|
|
498
|
+
<td>append(<b>data</b>, consume)</td>
|
|
499
|
+
</tr>
|
|
500
|
+
<th align="center" colspan="4"><i>Math</i></th>
|
|
501
|
+
<tr>
|
|
502
|
+
<td>Name</td>
|
|
503
|
+
<td>xor(<b>xorKey</b>, startOffset, endOffset, consume)
|
|
504
|
+
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
505
|
+
<td >XOR data. <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
506
|
+
</tr>
|
|
507
|
+
<tr>
|
|
508
|
+
<td>Name</td>
|
|
509
|
+
<td>xorThis(<b>xorKey</b>, length, consume)
|
|
510
|
+
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for Uint8Array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
511
|
+
<td>XOR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
512
|
+
</tr>
|
|
513
|
+
<tr>
|
|
514
|
+
<td>Name</td>
|
|
515
|
+
<td>or(<b>orKey</b>, startOffset, endOffset, consume)
|
|
516
|
+
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
517
|
+
<td >OR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
518
|
+
</tr>
|
|
519
|
+
<tr>
|
|
520
|
+
<td>Name</td>
|
|
521
|
+
<td>orThis(<b>orKey</b>, length, consume)
|
|
522
|
+
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for Uint8Array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
523
|
+
<td>OR data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
524
|
+
</tr>
|
|
525
|
+
<tr>
|
|
526
|
+
<td>Name</td>
|
|
527
|
+
<td>and(<b>andKey</b>, startOffset, endOffset, consume)
|
|
528
|
+
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
529
|
+
<td >AND data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
530
|
+
</tr>
|
|
531
|
+
<tr>
|
|
532
|
+
<td>Name</td>
|
|
533
|
+
<td>andThis(<b>andKey</b>, length, consume)
|
|
534
|
+
<td align="center"><b>Byte value, string, Uint8Array or Buffer</b>, length of bytes starting at current byte (repeats when longer, default 1 byte for byte value, string length or end of data for string, array length or end of data for Uint8Array or Buffer), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
535
|
+
<td>AND data <b>Note:</b> Will loop if operation length is longer than supplied key.</td>
|
|
536
|
+
</tr>
|
|
537
|
+
<tr>
|
|
538
|
+
<td>Name</td>
|
|
539
|
+
<td>add(<b>shiftValue</b>, startOffset, endOffset, consume)
|
|
540
|
+
<td align="center"><b>Value</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
541
|
+
<td >Add value to data (per byte)</td>
|
|
542
|
+
</tr>
|
|
543
|
+
<tr>
|
|
544
|
+
<td>Name</td>
|
|
545
|
+
<td>addThis(<b>shiftValue</b>, length, consume)
|
|
546
|
+
<td align="center"><b>Value</b>, length of bytes starting at current byte (default 1), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
547
|
+
<td>Add value to data (per byte)</td>
|
|
548
|
+
</tr>
|
|
549
|
+
<tr>
|
|
550
|
+
<td>Name</td>
|
|
551
|
+
<td>not(startOffset, endOffset, consume)
|
|
552
|
+
<td align="center">Byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
553
|
+
<td >NOT data (per byte)</td>
|
|
321
554
|
</tr>
|
|
322
555
|
<tr>
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
556
|
+
<td>Name</td>
|
|
557
|
+
<td>notThis(length, consume)
|
|
558
|
+
<td align="center">Length of bytes starting at current byte position (default 1), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
559
|
+
<td>NOT data (per byte)</td>
|
|
327
560
|
</tr>
|
|
328
561
|
<tr>
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
562
|
+
<td>Name</td>
|
|
563
|
+
<td>lShift(<b>shiftValue</b>, startOffset, endOffset, consume)
|
|
564
|
+
<td align="center"><b>Value</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
565
|
+
<td >Left shift data (per byte)</td>
|
|
333
566
|
</tr>
|
|
334
567
|
<tr>
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
568
|
+
<td>Name</td>
|
|
569
|
+
<td>lShiftThis(<b>shiftValue</b>, length, consume)
|
|
570
|
+
<td align="center"><b>Value</b>, length of bytes starting at current byte (default 1), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
571
|
+
<td>Left shift data (per byte)</td>
|
|
572
|
+
</tr>
|
|
573
|
+
<tr>
|
|
574
|
+
<td>Name</td>
|
|
575
|
+
<td>rShift(<b>shiftValue</b>, startOffset, endOffset, consume)
|
|
576
|
+
<td align="center"><b>Value</b>, byte position to start (default current position), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
577
|
+
<td >Right shift data (per byte)</td>
|
|
578
|
+
</tr>
|
|
579
|
+
<tr>
|
|
580
|
+
<td>Name</td>
|
|
581
|
+
<td>rShiftThis(<b>shiftValue</b>, length, consume)
|
|
582
|
+
<td align="center"><b>Value</b>, length of bytes starting at current byte (default 1), byte position to end (default end of data), move byte position to after operation (default false)</td>
|
|
583
|
+
<td>Right shift data (per byte)</td>
|
|
339
584
|
</tr>
|
|
340
585
|
</tbody>
|
|
341
586
|
</table>
|
|
@@ -344,7 +589,7 @@ Common functions for setup and movement shared by both (unless indicated).
|
|
|
344
589
|
|
|
345
590
|
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).
|
|
346
591
|
|
|
347
|
-
**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()``.
|
|
592
|
+
**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.
|
|
348
593
|
|
|
349
594
|
<table>
|
|
350
595
|
<thead>
|
|
@@ -361,8 +606,8 @@ Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be
|
|
|
361
606
|
<td><b>number of bits</b>, if the value is returned unsigned, big or little endian</td>
|
|
362
607
|
</tr>
|
|
363
608
|
<tr>
|
|
364
|
-
<td>writeBit(<b>value, bits</b>,
|
|
365
|
-
<td><b>value to write, number of bits</b>,
|
|
609
|
+
<td>writeBit(<b>value, bits</b>, unsigned, endian)</td>
|
|
610
|
+
<td><b>value to write, number of bits</b>, if the value is written unsigned, big or little endian<br>Note: Will throw error if value is outside of size of data</td>
|
|
366
611
|
</tr>
|
|
367
612
|
<tr>
|
|
368
613
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -371,8 +616,8 @@ Parse value as a bit field. There are 32 functions from bit1 to bit32 and can be
|
|
|
371
616
|
</tr>
|
|
372
617
|
<tr>
|
|
373
618
|
<td align="center"><b>Presets (writer)</b></td>
|
|
374
|
-
<td>[u]bit{1-32}{le|be}(<b>value</b>,
|
|
375
|
-
<td><b>value to write</b>,
|
|
619
|
+
<td>[u]bit{1-32}{le|be}(<b>value</b>, *unsigned)</td>
|
|
620
|
+
<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>
|
|
376
621
|
</tr>
|
|
377
622
|
</tbody>
|
|
378
623
|
</table>
|
|
@@ -406,8 +651,8 @@ Parse value as a byte (aka int8). Can be signed or unsigned (with a ``u`` at the
|
|
|
406
651
|
</tr>
|
|
407
652
|
<tr>
|
|
408
653
|
<td align="center"><b>Presets (writer)</b></td>
|
|
409
|
-
<td>[u]{byte|int8}(<b>value</b>,
|
|
410
|
-
<td><b>value to write</b>,
|
|
654
|
+
<td>[u]{byte|int8}(<b>value</b>, *unsigned)</td>
|
|
655
|
+
<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>
|
|
411
656
|
</tr>
|
|
412
657
|
</tbody>
|
|
413
658
|
</table>
|
|
@@ -431,8 +676,8 @@ Parse value as a int16 (aka short or word). Can be signed or unsigned (with a ``
|
|
|
431
676
|
<td>if the value is returned unsigned, big or little endian</td>
|
|
432
677
|
</tr>
|
|
433
678
|
<tr>
|
|
434
|
-
<td>writeInt16(<b>value</b>,
|
|
435
|
-
<td><b>value to write</b>,
|
|
679
|
+
<td>writeInt16(<b>value</b>, unsigned, endian)</td>
|
|
680
|
+
<td><b>value to write</b>, if the value is written unsigned, big or little endian<br>Note: Will throw error if value is outside of size of data</td>
|
|
436
681
|
</tr>
|
|
437
682
|
<tr>
|
|
438
683
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -441,7 +686,7 @@ Parse value as a int16 (aka short or word). Can be signed or unsigned (with a ``
|
|
|
441
686
|
</tr>
|
|
442
687
|
<tr>
|
|
443
688
|
<td align="center"><b>Presets (writer)</b></td>
|
|
444
|
-
<td>[u]{int16|word|short}{be|le}(<b>value</b>,
|
|
689
|
+
<td>[u]{int16|word|short}{be|le}(<b>value</b>, *unsigned, *endian)</td>
|
|
445
690
|
<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>
|
|
446
691
|
</tr>
|
|
447
692
|
</tbody>
|
|
@@ -466,8 +711,8 @@ Parse value as a half float (aka half). Can be in little or big endian order (``
|
|
|
466
711
|
<td>big or little endian</td>
|
|
467
712
|
</tr>
|
|
468
713
|
<tr>
|
|
469
|
-
<td>writeHalfFloat(<b>value</b>,
|
|
470
|
-
<td><b>value to write</b>,
|
|
714
|
+
<td>writeHalfFloat(<b>value</b>, endian)</td>
|
|
715
|
+
<td><b>value to write</b>, big or little endian<br>Note: Will throw error if value is outside of size of data</td>
|
|
471
716
|
</tr>
|
|
472
717
|
<tr>
|
|
473
718
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -476,8 +721,8 @@ Parse value as a half float (aka half). Can be in little or big endian order (``
|
|
|
476
721
|
</tr>
|
|
477
722
|
<tr>
|
|
478
723
|
<td align="center"><b>Presets (writer)</b></td>
|
|
479
|
-
<td>{halffloat|half}{be|le}(<b>value</b>,
|
|
480
|
-
<td><b>value to write</b>,
|
|
724
|
+
<td>{halffloat|half}{be|le}(<b>value</b>, *endian)</td>
|
|
725
|
+
<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>
|
|
481
726
|
</tr>
|
|
482
727
|
</tbody>
|
|
483
728
|
</table>
|
|
@@ -501,8 +746,8 @@ Parse value as a int32 (aka int, long or double). Can be signed or unsigned (wi
|
|
|
501
746
|
<td>if the value is returned unsigned, big or little endian</td>
|
|
502
747
|
</tr>
|
|
503
748
|
<tr>
|
|
504
|
-
<td>writeInt32(<b>value</b>,
|
|
505
|
-
<td><b>value to write</b>,
|
|
749
|
+
<td>writeInt32(<b>value</b>, unsigned, endian)</td>
|
|
750
|
+
<td><b>value to write</b>, if the value is written unsigned, big or little endian<br>Note: Will throw error if value is outside of size of data</td>
|
|
506
751
|
</tr>
|
|
507
752
|
<tr>
|
|
508
753
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -511,8 +756,8 @@ Parse value as a int32 (aka int, long or double). Can be signed or unsigned (wi
|
|
|
511
756
|
</tr>
|
|
512
757
|
<tr>
|
|
513
758
|
<td align="center"><b>Presets (writer)</b></td>
|
|
514
|
-
<td>[u]{int32|long|int|double}{be|le}(<b>value</b>,
|
|
515
|
-
<td><b>value to write</b>,
|
|
759
|
+
<td>[u]{int32|long|int|double}{be|le}(<b>value</b>, *unsigned, *endian)</td>
|
|
760
|
+
<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>
|
|
516
761
|
</tr>
|
|
517
762
|
</tbody>
|
|
518
763
|
</table>
|
|
@@ -536,8 +781,8 @@ Parse value as a float. Can be in little or big endian order (``be`` or ``le`` a
|
|
|
536
781
|
<td>big or little endian</td>
|
|
537
782
|
</tr>
|
|
538
783
|
<tr>
|
|
539
|
-
<td>writeInt64(<b>value</b>,
|
|
540
|
-
<td><b>value to write</b>,
|
|
784
|
+
<td>writeInt64(<b>value</b>, endian)</td>
|
|
785
|
+
<td><b>value to write</b>, big or little endian<br>Note: Will throw error if value is outside of size of data</td>
|
|
541
786
|
</tr>
|
|
542
787
|
<tr>
|
|
543
788
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -546,8 +791,8 @@ Parse value as a float. Can be in little or big endian order (``be`` or ``le`` a
|
|
|
546
791
|
</tr>
|
|
547
792
|
<tr>
|
|
548
793
|
<td align="center"><b>Presets (writer)</b></td>
|
|
549
|
-
<td>float{be|le}(<b>value</b>,
|
|
550
|
-
<td><b>value to write</b>,
|
|
794
|
+
<td>float{be|le}(<b>value</b>, *endian)</td>
|
|
795
|
+
<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>
|
|
551
796
|
</tr>
|
|
552
797
|
</tbody>
|
|
553
798
|
</table>
|
|
@@ -571,8 +816,8 @@ Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `
|
|
|
571
816
|
<td>if the value is returned unsigned, big or little endian</td>
|
|
572
817
|
</tr>
|
|
573
818
|
<tr>
|
|
574
|
-
<td>writeInt64(<b>value</b>,
|
|
575
|
-
<td><b>value to write</b>,
|
|
819
|
+
<td>writeInt64(<b>value</b>, unsigned, endian)</td>
|
|
820
|
+
<td><b>value to write</b>, if the value is written unsigned, big or little endian<br>Note: Will throw error if value is outside of size of data</td>
|
|
576
821
|
</tr>
|
|
577
822
|
<tr>
|
|
578
823
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -581,8 +826,8 @@ Parse value as a int64 (aka quad or bigint). Can be signed or unsigned (with a `
|
|
|
581
826
|
</tr>
|
|
582
827
|
<tr>
|
|
583
828
|
<td align="center"><b>Presets (writer)</b></td>
|
|
584
|
-
<td>[u]{int64|quad|bigint}{be|le}(<b>value</b>,
|
|
585
|
-
<td><b>value to write</b>,
|
|
829
|
+
<td>[u]{int64|quad|bigint}{be|le}(<b>value</b>, *unsigned, *endian)</td>
|
|
830
|
+
<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>
|
|
586
831
|
</tr>
|
|
587
832
|
</tbody>
|
|
588
833
|
</table>
|
|
@@ -606,8 +851,8 @@ Parse value as a double float (aka dfloat). Can be in little or big endian order
|
|
|
606
851
|
<td>big or little endian</td>
|
|
607
852
|
</tr>
|
|
608
853
|
<tr>
|
|
609
|
-
<td>writeDoubleFloat(<b>value</b>,
|
|
610
|
-
<td><b>value to write</b>,
|
|
854
|
+
<td>writeDoubleFloat(<b>value</b>, endian)</td>
|
|
855
|
+
<td><b>value to write</b>, big or little endian.<br>Note: Will throw error if value is outside of size of data</td>
|
|
611
856
|
</tr>
|
|
612
857
|
<tr>
|
|
613
858
|
<td align="center"><b>Presets (reader)</b></td>
|
|
@@ -616,8 +861,8 @@ Parse value as a double float (aka dfloat). Can be in little or big endian order
|
|
|
616
861
|
</tr>
|
|
617
862
|
<tr>
|
|
618
863
|
<td align="center"><b>Presets (writer)</b></td>
|
|
619
|
-
<td>{doublefloat|dfloat}{be|le}(<b>value</b>,
|
|
620
|
-
<td><b>Value to write</b>,
|
|
864
|
+
<td>{doublefloat|dfloat}{be|le}(<b>value</b>, *endian)</td>
|
|
865
|
+
<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>
|
|
621
866
|
</tr>
|
|
622
867
|
</tbody>
|
|
623
868
|
</table>
|
|
@@ -680,13 +925,13 @@ Presents include C or Unicode, Ansi and multiple pascals.
|
|
|
680
925
|
<tr>
|
|
681
926
|
<td align="center"><b>Presets (writer)</b></td>
|
|
682
927
|
<td>
|
|
683
|
-
{c|utf8}string(<b>string</b>,
|
|
684
|
-
ansistring(<b>string</b>,
|
|
685
|
-
{utf16|uni}string{be|le}(<b>string</b>,
|
|
686
|
-
pstring(<b>string</b>,
|
|
687
|
-
pstring{1|2|4}{be|le}(<b>string</b>,
|
|
688
|
-
wpstring{be|le}(<b>string</b>,
|
|
689
|
-
wpstring{1|2|4}{be|le}(<b>string</b>,
|
|
928
|
+
{c|utf8}string(<b>string</b>, length, terminateValue)<br><br>
|
|
929
|
+
ansistring(<b>string</b>, length, terminateValue)<br><br>
|
|
930
|
+
{utf16|uni}string{be|le}(<b>string</b>,length, terminateValue, *endian)<br><br>
|
|
931
|
+
pstring(<b>string</b>, lengthWriteSize, *endian)<br><br>
|
|
932
|
+
pstring{1|2|4}{be|le}(<b>string</b>, *endian)<br><br>
|
|
933
|
+
wpstring{be|le}(<b>string</b>, lengthWriteSize, *endian)<br><br>
|
|
934
|
+
wpstring{1|2|4}{be|le}(<b>string</b>, *endian)
|
|
690
935
|
</td>
|
|
691
936
|
<td>Based on above.<br><b>Note:</b> Presets use augments not a single object. Endian only needed when not part of function name. Does not override set endian.</td>
|
|
692
937
|
</tr>
|