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

Function modifyFile

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

Source from the content-addressed store, hash-verified

70 }
71
72 async function modifyFile() {
73 const fileHandle = await getRandomFileHandle();
74 if (!fileHandle) {
75 return;
76 }
77 const writable = await fileHandle.createWritable();
78 const text = loremIpsum.repeat(Math.floor(Math.random() * 20) + 1);
79 await writable.write(text);
80 await writable.close();
81 logMessage(`📝 Modified file "${fileHandle.name}"`);
82 }
83
84 async function performRandomOperation() {
85 const operations = [createFile, deleteFile, modifyFile];

Callers

nothing calls this directly

Calls 4

getRandomFileHandleFunction · 0.85
logMessageFunction · 0.70
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected