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

Function createFile

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

Source from the content-addressed store, hash-verified

49 }
50
51 async function createFile() {
52 const fileName = `file_${Date.now()}.txt`;
53 const fileHandle = await rootHandle.getFileHandle(fileName, {
54 create: true,
55 });
56 const writable = await fileHandle.createWritable();
57 const text = loremIpsum.repeat(Math.floor(Math.random() * 20) + 1);
58 await writable.write(text);
59 await writable.close();
60 logMessage(`✅ Created file "${fileName}"`);
61 }
62
63 async function deleteFile() {
64 const fileHandle = await getRandomFileHandle();

Callers

nothing calls this directly

Calls 3

logMessageFunction · 0.70
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected