bireader 1.0.58 → 1.0.59

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
@@ -169,7 +169,7 @@ function parse_webp(data){
169
169
 
170
170
  //write example - write a webp file from read data
171
171
  function write_webp(data){
172
- const bw = new biwriter(new Uint8Arry(1)) //extends array as we write by default
172
+ const bw = new biwriter(new Uint8Arry(0x100000)) // Will extends array as we write if needed by default
173
173
  bw.string("RIFF",{length:4})
174
174
  bw.uint32le(0) //dummy for now, will be final size - 8
175
175
  bw.string("WEBP",{length:4})
@@ -291,7 +291,7 @@ Common functions for setup, movement, manipulation and math shared by both.
291
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> Data can always be found with .data. Also biwrite can created without data and will default to a supplied offset as a Buffer (if available) or Uint8Array.</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>
package/lib/cjs/index.cjs CHANGED
@@ -1226,11 +1226,12 @@ function rfloat(_this, endian) {
1226
1226
  }
1227
1227
  function wfloat(_this, value, endian) {
1228
1228
  check_size(_this, 4, 0);
1229
- const MIN_POSITIVE_FLOAT32 = 1.17549435e-38;
1229
+ const MIN_POSITIVE_FLOAT32 = Number.MIN_VALUE;
1230
1230
  const MAX_POSITIVE_FLOAT32 = 3.4028235e+38;
1231
1231
  const MIN_NEGATIVE_FLOAT32 = -3.4028235e+38;
1232
- const MAX_NEGATIVE_FLOAT32 = -1.17549435e-38;
1233
- if (!((value === 0) || (value >= MIN_POSITIVE_FLOAT32 && value <= MAX_POSITIVE_FLOAT32) ||
1232
+ const MAX_NEGATIVE_FLOAT32 = -Number.MIN_VALUE;
1233
+ if (!((value === 0) ||
1234
+ (value >= MIN_POSITIVE_FLOAT32 && value <= MAX_POSITIVE_FLOAT32) ||
1234
1235
  (value >= MIN_NEGATIVE_FLOAT32 && value <= MAX_NEGATIVE_FLOAT32))) {
1235
1236
  _this.errorDump ? "[Error], hexdump:\n" + _this.hexdump() : "";
1236
1237
  throw new Error('Value is out of range for the specified float length.' + " min: " + MIN_NEGATIVE_FLOAT32 + " max: " + MAX_POSITIVE_FLOAT32 + " value: " + value);
@@ -1337,8 +1338,8 @@ function wint64(_this, value, unsigned, endian) {
1337
1338
  function wdfloat(_this, value, endian) {
1338
1339
  check_size(_this, 8, 0);
1339
1340
  const MIN_POSITIVE_FLOAT64 = 2.2250738585072014e-308;
1340
- const MAX_POSITIVE_FLOAT64 = 1.7976931348623157e+308;
1341
- const MIN_NEGATIVE_FLOAT64 = -1.7976931348623157e+308;
1341
+ const MAX_POSITIVE_FLOAT64 = Number.MAX_VALUE;
1342
+ const MIN_NEGATIVE_FLOAT64 = -Number.MAX_VALUE;
1342
1343
  const MAX_NEGATIVE_FLOAT64 = -2.2250738585072014e-308;
1343
1344
  if (!((value === 0) ||
1344
1345
  (value >= MIN_POSITIVE_FLOAT64 && value <= MAX_POSITIVE_FLOAT64) ||