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

Function paxRecord

packages/effect/src/encoding/Tar.ts:739–747  ·  view source on GitHub ↗
(key: string, value: string)

Source from the content-addressed store, hash-verified

737}
738
739const paxRecord = (key: string, value: string): Uint8Array => {
740 const rest = textEncoder.encode(` ${key}=${value}\n`)
741 // The length counts its own digits
742 const length = rest.length + String(rest.length + String(rest.length).length).length
743 const out = new Uint8Array(length)
744 writeString(out, 0, length, String(length))
745 out.set(rest, length - rest.length)
746 return out
747}
748
749const paxHeaderName = (path: string): string => {
750 const trimmed = path.replace(/\/+$/, "")

Callers 1

encodeHeaderFunction · 0.85

Calls 4

writeStringFunction · 0.85
encodeMethod · 0.80
setMethod · 0.65
StringFunction · 0.50

Tested by

no test coverage detected