MCPcopy Create free account
hub / github.com/Effect-TS/effect / readUnsigned

Function readUnsigned

packages/effect/src/encoding/Tar.ts:805–811  ·  view source on GitHub ↗
(block: Uint8Array, offset: number, length: number, field: string)

Source from the content-addressed store, hash-verified

803}
804
805const readUnsigned = (block: Uint8Array, offset: number, length: number, field: string): number => {
806 const value = readNumber(block, offset, length)
807 if (value < 0) {
808 throw invalidHeader(`negative ${field}`)
809 }
810 return value
811}
812
813// The checksum is the sum of the block bytes with the checksum field counted as
814// spaces. Some old tar writers summed signed bytes, which is accepted too.

Callers 1

parseHeaderFunction · 0.85

Calls 2

readNumberFunction · 0.70
invalidHeaderFunction · 0.70

Tested by

no test coverage detected