MCPcopy
hub / github.com/jvilk/BrowserFS / getDirListing

Method getDirListing

src/generic/key_value_filesystem.ts:504–513  ·  view source on GitHub ↗

* Given the Inode of a directory, retrieves the corresponding directory * listing.

(tx: SyncKeyValueROTransaction, p: string, inode: Inode)

Source from the content-addressed store, hash-verified

502 * listing.
503 */
504 private getDirListing(tx: SyncKeyValueROTransaction, p: string, inode: Inode): { [fileName: string]: string } {
505 if (!inode.isDirectory()) {
506 throw ApiError.ENOTDIR(p);
507 }
508 const data = tx.get(inode.id);
509 if (data === undefined) {
510 throw ApiError.ENOENT(p);
511 }
512 return JSON.parse(data.toString());
513 }
514
515 /**
516 * Creates a new node under a random ID. Retries 5 times before giving up in

Callers 5

renameSyncMethod · 0.95
readdirSyncMethod · 0.95
readDirectoryMethod · 0.95
commitNewFileMethod · 0.95
removeEntryMethod · 0.95

Calls 5

ENOTDIRMethod · 0.80
ENOENTMethod · 0.80
toStringMethod · 0.80
getMethod · 0.65
isDirectoryMethod · 0.45

Tested by

no test coverage detected