MCPcopy Create free account
hub / github.com/cloudflare/computer / readChunkBytes

Function readChunkBytes

packages/dofs/src/fs/writeFile.ts:377–389  ·  view source on GitHub ↗
(db: Database, inode: number, idx: number)

Source from the content-addressed store, hash-verified

375}
376
377function readChunkBytes(db: Database, inode: number, idx: number): Uint8Array {
378 const chunk = db.one<{ hash: Uint8Array }>(
379 "SELECT hash FROM vfs_chunks WHERE inode = ? AND idx = ?",
380 inode,
381 idx,
382 );
383 if (chunk === undefined) return new Uint8Array();
384 const bytes = getBlobBytes(db, chunk.hash);
385 if (bytes === undefined) {
386 throw createWorkspaceError("EIO", "missing blob bytes");
387 }
388 return bytes;
389}
390
391function resolveFileInode(db: Database, path: string): { inode: number; mode: number } {
392 const { path: canonical } = canonicalizePath(path);

Callers 2

applyChunkedInodeUpdateFunction · 0.85
hydrateBufferIfNeededFunction · 0.85

Calls 3

getBlobBytesFunction · 0.85
oneMethod · 0.80
createWorkspaceErrorFunction · 0.50

Tested by

no test coverage detected