MCPcopy Index your code
hub / github.com/coder/coder / fillHeader

Method fillHeader

site/src/utils/tar.ts:314–339  ·  view source on GitHub ↗
(
		offset: number,
		opts: Partial<ITarWriteOptions>,
		fileType: TarFileType,
	)

Source from the content-addressed store, hash-verified

312 }
313
314 private fillHeader(
315 offset: number,
316 opts: Partial<ITarWriteOptions>,
317 fileType: TarFileType,
318 ) {
319 const { uid, gid, mode, mtime, user, group } = {
320 uid: 1000,
321 gid: 1000,
322 mode: fileType === TarFileTypeCodes.File ? 0o664 : 0o775,
323 mtime: Math.trunc(Date.now() / 1000),
324 user: "tarballjs",
325 group: "tarballjs",
326 ...opts,
327 };
328
329 this.writeFileMode(mode, offset);
330 this.writeFileUid(uid, offset);
331 this.writeFileGid(gid, offset);
332 this.writeFileMtime(mtime, offset);
333
334 this.writeString("ustar", offset + 257, 6); // magic string
335 this.writeString("00", offset + 263, 2); // magic version
336
337 this.writeFileUser(user, offset);
338 this.writeFileGroup(group, offset);
339 }
340}
341
342function getArrayBuffer(file: string | ArrayBuffer | Uint8Array | Blob) {

Callers 1

writeMethod · 0.95

Calls 8

writeFileModeMethod · 0.95
writeFileUidMethod · 0.95
writeFileGidMethod · 0.95
writeFileMtimeMethod · 0.95
writeStringMethod · 0.95
writeFileUserMethod · 0.95
writeFileGroupMethod · 0.95
nowMethod · 0.45

Tested by

no test coverage detected