MCPcopy Create free account
hub / github.com/callstack/agent-device / createResumableUploadEntry

Function createResumableUploadEntry

src/daemon/resumable-upload.ts:156–179  ·  view source on GitHub ↗
(
  options: BeginResumableUploadOptions,
  key: string,
)

Source from the content-addressed store, hash-verified

154}
155
156function createResumableUploadEntry(
157 options: BeginResumableUploadOptions,
158 key: string,
159): ResumableUploadEntry {
160 const id = crypto.randomUUID();
161 const tempDir = createArtifactTempDir('upload');
162 const entry: ResumableUploadEntry = {
163 id,
164 key,
165 tempDir,
166 payloadPath: path.join(tempDir, 'payload'),
167 fileName: sanitizeArtifactFilename(options.fileName),
168 sizeBytes: options.sizeBytes,
169 sha256: options.sha256.toLowerCase(),
170 artifactType: options.artifactType,
171 platform: options.platform,
172 tenantId: options.tenantId,
173 timer: setTimeout(() => cleanupResumableUpload(id), RESUMABLE_UPLOAD_CLEANUP_TIMEOUT_MS),
174 };
175 entry.timer.unref();
176 RESUMABLE_UPLOADS_BY_ID.set(id, entry);
177 RESUMABLE_UPLOADS_BY_KEY.set(key, id);
178 return entry;
179}
180
181function refreshResumableUploadTimer(entry: ResumableUploadEntry): void {
182 clearTimeout(entry.timer);

Callers 1

beginResumableUploadFunction · 0.85

Calls 4

createArtifactTempDirFunction · 0.90
sanitizeArtifactFilenameFunction · 0.90
cleanupResumableUploadFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…