0

I'm trying to process local files in browser using File API. Everything works fine except the move() method gives exception: "Uncaught (in promise) DOMException: The user aborted a request." Browser prompts me to allow the activity in folder: "Save changes to myfolder" and then throws the error.

Somewhere in internet I got the message like the move() method is not supported, but in other places it is described how to use it without any warnings.

I wonder am I doing something wrong or does this error mean that functionality is not supported?

async function getDir() {
  const dirHandle = await window.showDirectoryPicker();
  const root = await navigator.storage.getDirectory();
  const archiveHandle = await root.getDirectoryHandle('processed', {create: true});
  for await (const entry of dirHandle.values()) {
    if (entry.kind !== 'file') {
      continue;
    }
    console.info(entry.name);
    let response = await processFile(entry);
    if (response === "OK") {
      await entry.move(entry.name + ".bck"); //Here comes the error
    }
  }
}
Riho
  • 4,523
  • 3
  • 33
  • 48

0 Answers0