0

How I can retrive the content of a file using the following code that get a file stored in indexedDB

button1.addEventListener('click', async () => {
  try {
    const fileHandleOrUndefined = await get('file');
    if (fileHandleOrUndefined) {
      pre1.textContent = `Retrieved file handle "${fileHandleOrUndefined.name}" from IndexedDB.`;
/* now I have to read the content*/
      return;
    }

When I use tu get the file from file system I use this code ad is working good

const [fileHandle] = await window.showOpenFilePicker();
    await set("file", fileHandle);
    const file = await fileHandle.getFile();
    const content = await file.text();
    console.log(content)

I try with await fileHandle.getFile() but I know that is not correct. I sure that where is a way to do that,.

Aldo
  • 21
  • 2

0 Answers0