MCPcopy Create free account
hub / github.com/GoogleChrome/samples / getRandomFileHandle

Function getRandomFileHandle

file-system-observer/random.js:37–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 }
36
37 async function getRandomFileHandle() {
38 const files = [];
39 for await (const entry of rootHandle.values()) {
40 if (entry.kind === 'file') {
41 files.push(entry);
42 }
43 }
44 if (files.length === 0) {
45 return null;
46 }
47 const randomIndex = Math.floor(Math.random() * files.length);
48 return files[randomIndex];
49 }
50
51 async function createFile() {
52 const fileName = `file_${Date.now()}.txt`;

Callers 2

deleteFileFunction · 0.85
modifyFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected