• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visgl / loaders.gl / 20352515932

18 Dec 2025 09:56PM UTC coverage: 35.115% (-28.4%) from 63.485%
20352515932

push

github

web-flow
feat(loader-utils): Export is-type helpers (#3258)

1188 of 1998 branches covered (59.46%)

Branch coverage included in aggregate %.

147 of 211 new or added lines in 13 files covered. (69.67%)

30011 existing lines in 424 files now uncovered.

37457 of 108056 relevant lines covered (34.66%)

0.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

28.21
/modules/gis/src/lib/utils/binary-reader.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
/** A DataView that tracks byte offset when reading. */
1✔
6
export class BinaryReader {
1✔
7
  arrayBuffer: ArrayBuffer;
1!
UNCOV
8
  dataView: DataView;
×
UNCOV
9
  byteOffset: number;
×
UNCOV
10
  littleEndian: boolean;
×
11

1✔
12
  constructor(arrayBuffer: ArrayBuffer, isBigEndian: boolean = false) {
1✔
UNCOV
13
    this.arrayBuffer = arrayBuffer;
×
UNCOV
14
    this.dataView = new DataView(arrayBuffer);
×
UNCOV
15
    this.byteOffset = 0;
×
UNCOV
16
    this.littleEndian = !isBigEndian;
×
UNCOV
17
  }
×
18

1✔
19
  readUInt8() {
1✔
UNCOV
20
    const value = this.dataView.getUint8(this.byteOffset);
×
UNCOV
21
    this.byteOffset += 1;
×
UNCOV
22
    return value;
×
UNCOV
23
  }
×
24
  readUInt16() {
1✔
25
    const value = this.dataView.getUint16(this.byteOffset, this.littleEndian);
×
26
    this.byteOffset += 2;
×
27
    return value;
×
28
  }
×
29
  readUInt32() {
1✔
30
    const value = this.dataView.getUint32(this.byteOffset, this.littleEndian);
×
31
    this.byteOffset += 4;
×
32
    return value;
×
33
  }
×
34
  readInt8() {
1✔
35
    const value = this.dataView.getInt8(this.byteOffset);
×
36
    this.byteOffset += 1;
×
37
    return value;
×
38
  }
×
39
  readInt16() {
1✔
40
    const value = this.dataView.getInt16(this.byteOffset, this.littleEndian);
×
41
    this.byteOffset += 2;
×
42
    return value;
×
43
  }
×
44
  readInt32() {
1✔
45
    const value = this.dataView.getInt32(this.byteOffset, this.littleEndian);
×
46
    this.byteOffset += 4;
×
47
    return value;
×
48
  }
×
49
  readFloat() {
1✔
50
    const value = this.dataView.getFloat32(this.byteOffset, this.littleEndian);
×
51
    this.byteOffset += 4;
×
52
    return value;
×
53
  }
×
54
  readDouble() {
1✔
55
    const value = this.dataView.getFloat64(this.byteOffset, this.littleEndian);
×
56
    this.byteOffset += 8;
×
57
    return value;
×
58
  }
×
59

1✔
60
  readVarInt() {
1✔
UNCOV
61
    let result = 0;
×
UNCOV
62
    let bytesRead = 0;
×
UNCOV
63

×
UNCOV
64
    let nextByte;
×
UNCOV
65
    do {
×
UNCOV
66
      // TODO - this needs to be accessed via data view?
×
UNCOV
67
      nextByte = this.dataView.getUint8(this.byteOffset + bytesRead);
×
UNCOV
68
      result += (nextByte & 0x7f) << (7 * bytesRead);
×
UNCOV
69
      bytesRead++;
×
UNCOV
70
    } while (nextByte >= 0x80);
×
UNCOV
71

×
UNCOV
72
    this.byteOffset += bytesRead;
×
UNCOV
73

×
UNCOV
74
    return result;
×
UNCOV
75
  }
×
76
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc