Skip to content

v0.32.1

Compare
Choose a tag to compare
@tomayac tomayac released this 20 Feb 19:04
· 7 commits to main since this release
  • When the File System Access API is supported, the directoryOpen() function now returns the directory handle in the results array in case the directory is empty. Before, the function would return an empty array. This is a breaking change.

Warning

Breaking change:

// If the directory is empty, rather than `[]`,
// this function now returns `[directoryHandle]`
// when the File System Access API is supported.
const files = await directoryOpen();
// Check if there are files in the directory.
if (files.length && !(files[0] instanceof File)) {
  // The directory is empty and the returned item
  // is a `FileSystemDirectoryHandle`.
  const directoryHandle = files[0];
  return directoryHandle;
}
// There are files in the directory.
for (file of files) {
  // Iterate over the files.
}