Skip to content

Commit

Permalink
Update EXPLAINER.md
Browse files Browse the repository at this point in the history
- Add `multiple` option
- Clarify that `getParent` doesn't let you access the whole FS
- `getSystemDirectory` instead of `getSystemPath`
  • Loading branch information
mkruisselbrink committed Aug 1, 2018
1 parent 6db1886 commit 0d06aaf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion EXPLAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 22,7 @@ what we're providing is several bits:
// Show a file picker to open a file.
const file_ref = await FileSystemFileHandle.choose({
type: 'open',
multiple: false, // If true, returns an array rather than a single handle.
accepts: [{description: 'Images', extensions: ['jpg', 'gif', 'png']}],
suggestedStartLocation: 'pictures-library'
});
Expand Down Expand Up @@ -117,14 118,17 @@ await file_ref.copyTo(dir_ref, 'new_name', {overwrite: true});
// You can also navigate the file system:
const dir2 = await file_ref.getParent();
// dir2.fullPath == dir_ref.fullPath.

// But you can't escape from the directory you've been given access to.
// await dir_ref.getParent() == null
```

And perhaps even possible to get access to certain "well-known" directories,
without showing a file picker, i.e. to get access to all fonts, all photos, or
similar. Could still include some kind of permission prompt if needed.

```javascript
const font_dir = await FileSystemDirectoryHandle.getSystemPath({type: 'fonts'});
const font_dir = await FileSystemDirectoryHandle.getSystemDirectory({type: 'fonts'});
for await (const entry of font_dir.entries()) {
// Use font entry.
};
Expand Down

0 comments on commit 0d06aaf

Please sign in to comment.