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

Method addFile

site/src/utils/tar.ts:182–197  ·  view source on GitHub ↗
(
		name: string,
		file: string | ArrayBuffer | Uint8Array | Blob,
		opts?: Partial<ITarWriteOptions>,
	)

Source from the content-addressed store, hash-verified

180 }
181
182 addFile(
183 name: string,
184 file: string | ArrayBuffer | Uint8Array | Blob,
185 opts?: Partial<ITarWriteOptions>,
186 ) {
187 const data = getArrayBuffer(file);
188 const size = (data as ArrayBuffer).byteLength ?? (file as Blob).size;
189 const item: ITarWriteItem = {
190 name,
191 type: TarFileTypeCodes.File,
192 data,
193 size,
194 opts,
195 };
196 this.fileData.push(item);
197 }
198
199 addFolder(name: string, opts?: Partial<ITarWriteOptions>) {
200 this.fileData.push({

Callers 4

generateVersionFilesFunction · 0.95
createTemplateVersionTarFunction · 0.95
tar.test.tsFile · 0.80

Calls 2

getArrayBufferFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected