MCPcopy Index your code
hub / github.com/cameri/nostream / readFileHeader

Function readFileHeader

src/utils/compression.ts:120–131  ·  view source on GitHub ↗
(filePath: string, bytes = XZ_MAGIC.length)

Source from the content-addressed store, hash-verified

118}
119
120const readFileHeader = async (filePath: string, bytes = XZ_MAGIC.length): Promise<Buffer> => {
121 const fileHandle = await open(filePath, 'r')
122
123 try {
124 const header = Buffer.alloc(bytes)
125 const { bytesRead } = await fileHandle.read(header, 0, bytes, 0)
126
127 return header.subarray(0, bytesRead)
128 } finally {
129 await fileHandle.close()
130 }
131}
132
133export const detectCompressionFormat = async (
134 filePath: string,

Callers 1

detectCompressionFormatFunction · 0.85

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected