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

Method record

packages/effect/src/encoding/Zip.ts:1097–1119  ·  view source on GitHub ↗
(header: Header, flags: number)

Source from the content-addressed store, hash-verified

1095 }
1096
1097 private record(header: Header, flags: number): EntryRecord {
1098 const name = textEncoder.encode(header.path)
1099 if (name.length > MAX16) throw invalidHeader(`path ${JSON.stringify(header.path)} is longer than 65535 bytes`)
1100 const { date, time } = toDos(header.mtime)
1101 const seconds = Math.floor(header.mtime.getTime() / 1000)
1102 const directory = header.type === "Directory"
1103 const mode = header.mode ?? (directory ? 0o755 : 0o644)
1104 return {
1105 name,
1106 // The UTF-8 byte length equals the string length only for ASCII
1107 flags: name.length === header.path.length ? flags : flags | FLAG_UTF8,
1108 method: header.type === "File" && header.method === "Deflate" ? 8 : 0,
1109 time,
1110 date,
1111 seconds: seconds >= 0 && seconds <= 0x7fffffff ? seconds : undefined,
1112 external: (((directory ? S_IFDIR : S_IFREG) | mode) * 0x10000 + (directory ? DOS_DIRECTORY : 0)) >>> 0,
1113 offset: this.offset,
1114 zip64: false,
1115 crc: 0,
1116 compressedSize: 0,
1117 size: 0
1118 }
1119 }
1120
1121 // Writes an entry whose content is known, with its sizes in the local header
1122 entry(header: Header, content: Uint8Array, data: Uint8Array): void {

Callers 15

entryMethod · 0.95
beginMethod · 0.95
makeFunction · 0.45
makeInternalFunction · 0.45
recordFunction · 0.45
attachFunction · 0.45
makeFunction · 0.45
suiteFunction · 0.45
recordFunction · 0.45
Runtime.test.tsFile · 0.45
SchemaAST.test.tsFile · 0.45

Calls 4

toDosFunction · 0.85
encodeMethod · 0.80
getTimeMethod · 0.80
invalidHeaderFunction · 0.70

Tested by 1

recordFunction · 0.36