How to use the fromBytesLE function from long

Find comprehensive JavaScript long.fromBytesLE code examples handpicked from public code repositorys.

182
183
184
185
186
187
188
189
190
}

readLong() {
    const size = BinaryUtils.getSize(BinaryUtils.TYPE_CODE.LONG)
    this._ensureSize(size);
    const value = Long.fromBytesLE([...this._buffer.slice(this._position, this._position + size)]);
    this._position += size;
    return value;
}
fork icon50
star icon0
watch icon1

9
10
11
12
13
14
15
16
17
18
 */
function decode (genericDecoder, buf, flag = 0) {
  let result = null
  if (flag === 1) {
    result = {
      value: Long.fromBytesLE(buf.slice(0)).toNumber(),
      length: 8
    }
  } else {
    result = {
fork icon18
star icon1
watch icon2

192
193
194
195
196
197
198
199
200
}

readLong(): Long {
    const size = BinaryUtils.getSize(BinaryUtils.TYPE_CODE.LONG);
    this._ensureSize(size);
    const value: Long = Long.fromBytesLE([...this._buffer.slice(this._position, this._position + size)]);
    this._position += size;
    return value;
}
fork icon7
star icon3
watch icon21

213
214
215
216
217
218
219

  return data
}

parsePseudoBin(bytes, offset) {
  // const one = Long.fromBytesLE(bytes.slice(offset + 4, offset + 12), true)
  // const two = Long.fromBytesLE(bytes.slice(offset + 12, offset + 20), true)
fork icon4
star icon0
watch icon1

+ 3 other calls in file

9
10
11
12
13
14
15
16
17
18
  else if (path) this.filehandle = new LocalFile(path)
  else throw new TypeError('either filehandle or path must be defined')
}

_readLongWithOverflow(buf, offset = 0, unsigned = true) {
  const long = Long.fromBytesLE(buf.slice(offset, offset + 8), unsigned)
  if (
    long.greaterThan(Number.MAX_SAFE_INTEGER) ||
    long.lessThan(Number.MIN_SAFE_INTEGER)
  )
fork icon3
star icon0
watch icon1