bireader 3.1.14 → 3.1.15

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.
@@ -342,6 +342,7 @@ function checkSize(ctx, write_bytes, write_bit, offset) {
342
342
  function extendarray(ctx, to_padd) {
343
343
  if ((typeof Buffer !== 'undefined' && ctx.data instanceof Buffer)) {
344
344
  var paddbuffer = Buffer.alloc(to_padd);
345
+ // @ts-ignore
345
346
  ctx.data = Buffer.concat([ctx.data, paddbuffer]);
346
347
  }
347
348
  else {
@@ -377,6 +378,7 @@ function remove(ctx, startOffset, endOffset, consume, remove, fillValue) {
377
378
  const part1 = ctx.data.subarray(0, new_start);
378
379
  const part2 = ctx.data.subarray(new_offset, ctx.size);
379
380
  if (isBuffer(ctx.data)) {
381
+ // @ts-ignore
380
382
  ctx.data = Buffer.concat([part1, part2]);
381
383
  }
382
384
  else {
@@ -391,6 +393,7 @@ function remove(ctx, startOffset, endOffset, consume, remove, fillValue) {
391
393
  const replacement = new Array(data_removed.length).fill(fillValue & 0xff);
392
394
  if (isBuffer(ctx.data)) {
393
395
  const buff_placement = Buffer.from(replacement);
396
+ // @ts-ignore
394
397
  ctx.data = Buffer.concat([part1, buff_placement, part2]);
395
398
  }
396
399
  else {
@@ -417,6 +420,7 @@ function addData(ctx, data, consume, offset, replace) {
417
420
  throw new Error(`\x1b[33m[Strict mode]\x1b[0m: Can not insert data in strict mode. Use unrestrict() to enable.`);
418
421
  }
419
422
  if (typeof Buffer !== 'undefined' && data instanceof Buffer && !(ctx.data instanceof Buffer)) {
423
+ // @ts-ignore
420
424
  data = Buffer.from(data);
421
425
  }
422
426
  if (data instanceof Uint8Array && !(ctx.data instanceof Uint8Array)) {
@@ -428,6 +432,7 @@ function addData(ctx, data, consume, offset, replace) {
428
432
  const part1 = ctx.data.subarray(0, needed_size - data.length);
429
433
  const part2 = ctx.data.subarray(needed_size, ctx.size);
430
434
  if (isBuffer(ctx.data)) {
435
+ // @ts-ignore
431
436
  ctx.data = Buffer.concat([part1, data, part2]);
432
437
  }
433
438
  else {
@@ -440,6 +445,7 @@ function addData(ctx, data, consume, offset, replace) {
440
445
  const part1 = ctx.data.subarray(0, needed_size);
441
446
  const part2 = ctx.data.subarray(needed_size, ctx.size);
442
447
  if (isBuffer(ctx.data)) {
448
+ // @ts-ignore
443
449
  ctx.data = Buffer.concat([part1, data, part2]);
444
450
  }
445
451
  else {
@@ -1403,16 +1409,16 @@ function wint64(ctx, value, unsigned, endian) {
1403
1409
  }
1404
1410
  else {
1405
1411
  if (unsigned == undefined || unsigned == false) {
1406
- ctx.data[ctx.offset + (1 - i) * 4 + 0] = int32Array[i];
1407
- ctx.data[ctx.offset + (1 - i) * 4 + 1] = (int32Array[i] >> 8);
1408
- ctx.data[ctx.offset + (1 - i) * 4 + 2] = (int32Array[i] >> 16);
1409
- ctx.data[ctx.offset + (1 - i) * 4 + 3] = (int32Array[i] >> 24);
1412
+ ctx.data[ctx.offset + (1 - i) * 4 + 3] = int32Array[i];
1413
+ ctx.data[ctx.offset + (1 - i) * 4 + 2] = (int32Array[i] >> 8);
1414
+ ctx.data[ctx.offset + (1 - i) * 4 + 1] = (int32Array[i] >> 16);
1415
+ ctx.data[ctx.offset + (1 - i) * 4 + 0] = (int32Array[i] >> 24);
1410
1416
  }
1411
1417
  else {
1412
- ctx.data[ctx.offset + (1 - i) * 4 + 0] = int32Array[i] & 0xFF;
1413
- ctx.data[ctx.offset + (1 - i) * 4 + 1] = (int32Array[i] >> 8) & 0xFF;
1414
- ctx.data[ctx.offset + (1 - i) * 4 + 2] = (int32Array[i] >> 16) & 0xFF;
1415
- ctx.data[ctx.offset + (1 - i) * 4 + 3] = (int32Array[i] >> 24) & 0xFF;
1418
+ ctx.data[ctx.offset + (1 - i) * 4 + 3] = int32Array[i] & 0xFF;
1419
+ ctx.data[ctx.offset + (1 - i) * 4 + 2] = (int32Array[i] >> 8) & 0xFF;
1420
+ ctx.data[ctx.offset + (1 - i) * 4 + 1] = (int32Array[i] >> 16) & 0xFF;
1421
+ ctx.data[ctx.offset + (1 - i) * 4 + 0] = (int32Array[i] >> 24) & 0xFF;
1416
1422
  }
1417
1423
  }
1418
1424
  }