MCPcopy Index your code
hub / github.com/simstudioai/sim / write

Function write

apps/sim/lib/uploads/core/storage-service.ts:317–334  ·  view source on GitHub ↗
(chunk)

Source from the content-addressed store, hash-verified

315
316 return {
317 async write(chunk) {
318 if (aborted) throw new Error('Multipart upload already aborted')
319 if (firstError) throw firstError
320 const buf = typeof chunk === 'string' ? Buffer.from(chunk, 'utf8') : chunk
321 totalBytes += buf.length
322 pendingChunks.push(buf)
323 pendingBytes += buf.length
324 // Local storage has no multipart concept — accumulate and write once on complete.
325 if (!cloud) return
326 while (pendingBytes >= MULTIPART_PART_SIZE) {
327 const merged = drainPending()
328 const part = merged.subarray(0, MULTIPART_PART_SIZE)
329 const rest = merged.subarray(MULTIPART_PART_SIZE)
330 pendingChunks = rest.length ? [rest] : []
331 pendingBytes = rest.length
332 await dispatchPart(part)
333 }
334 },
335 async complete() {
336 try {
337 if (!backend) {

Callers

nothing calls this directly

Calls 3

drainPendingFunction · 0.85
dispatchPartFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected