Closed sytolk closed 2 years ago
Fixed get handle without using browser-fs-access
You can obtain the handles from the returned files, see this demo and the relevant snippet below:
import { directoryOpen } from "https://unpkg.com/browser-fs-access";
document.querySelector("button").addEventListener("click", async () => {
const files = await directoryOpen({ recursive: true });
files.forEach((file) => {
console.log("FileSystemFileHandle", file.handle);
console.log("FileSystemDirectoryHandle", file.directoryHandle);
});
});
This is for the directory structure below:
The File System Access API return handle
but directoryOpen return files[] in selected directory:
How can I get selected directory path only?