Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix & pretty in FileSystemHandle interface #33502

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion files/en-us/web/api/filesystemdirectoryhandle/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _Inherits methods from its parent, {{DOMxRef("FileSystemHandle")}}._
Regular methods:

- {{domxref('FileSystemDirectoryHandle.getDirectoryHandle()')}}
- : Returns a {{jsxref('Promise')}} fulfilled with a {{domxref('FileSystemDirectoryHandle')}} for a subdirectory with the specified name within the directory handle on which the method is called.
- : Returns a {{jsxref('Promise')}} fulfilled with a `FileSystemDirectoryHandle` for a subdirectory with the specified name within the directory handle on which the method is called.
- {{domxref('FileSystemDirectoryHandle.getFileHandle()')}}
- : Returns a {{jsxref('Promise')}} fulfilled with a {{domxref('FileSystemFileHandle')}} for a file with the specified name, within the directory the method is called.
- {{domxref('FileSystemDirectoryHandle.removeEntry()')}}
Expand Down
6 changes: 3 additions & 3 deletions files/en-us/web/api/filesystemhandle/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ browser-compat: api.FileSystemHandle

{{securecontext_header}}{{APIRef("File System API")}}{{AvailableInWorkers}}

The **`FileSystemHandle`** interface of the {{domxref('File System API')}} is an object which represents a file or directory entry. Multiple handles can represent the same entry. For the most part you do not work with `FileSystemHandle` directly but rather its child interfaces {{domxref('FileSystemFileHandle')}} and {{domxref('FileSystemDirectoryHandle')}}.
The **`FileSystemHandle`** interface of the {{domxref('File System API', '', '', 'nocode')}} is an object which represents a file or directory entry. Multiple handles can represent the same entry. For the most part you do not work with `FileSystemHandle` directly but rather its child interfaces {{domxref('FileSystemFileHandle')}} and {{domxref('FileSystemDirectoryHandle')}}.

## Interfaces based on FileSystemHandle

Below is a list of interfaces based on the FileSystemHandle interface.
Below is a list of interfaces based on the `FileSystemHandle` interface.

- {{domxref("FileSystemFileHandle")}} {{SecureContext_Inline}}
- : Represents a handle to a file entry.
Expand All @@ -28,7 +28,7 @@ Below is a list of interfaces based on the FileSystemHandle interface.
## Instance methods

- {{domxref('FileSystemHandle.isSameEntry()', 'isSameEntry()')}}
- : Compares two {{domxref("FileSystemHandle", "handles")}} to see if the associated entries (either a file or directory) match.
- : Compares two handles to see if the associated entries (either a file or directory) match.
- {{domxref('FileSystemHandle.queryPermission()', 'queryPermission()')}} {{Experimental_Inline}}
- : Queries the current permission state of the current handle.
- {{domxref('FileSystemHandle.remove', 'remove()')}} {{Experimental_Inline}} {{Non-standard_Inline}}
Expand Down
11 changes: 6 additions & 5 deletions files/en-us/web/api/filesystemhandle/querypermission/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,24 @@ current handle.
## Syntax

```js-nolint
queryPermission(fileSystemHandlePermissionDescriptor)
queryPermission(descriptor)
```

### Parameters

- FileSystemHandlePermissionDescriptor {{optional_inline}}
- `descriptor` {{optional_inline}}

- : An object which specifies the permission mode to query for. Options are as follows:

- `'mode'`: Can be either `'read'` or
`'readwrite'`.
- `'mode'` {{optional_inline}}

- : Can be either `'read'` or `'readwrite'`.

### Return value

A {{jsxref("Promise")}} that resolves to a {{domxref("PermissionStatus")}} object.

If {{domxref('PermissionStatus.state')}} returns "prompt" the website will have to call requestPermission() before any
If {{domxref('PermissionStatus.state')}} returns "prompt" the website will have to call `requestPermission()` before any
operations on the handle can be done. If this returns "denied" any operations will
reject. Usually handles returned by the local file system handle factories will
initially return "granted" for their read permission state. However, other than through
Expand Down
5 changes: 3 additions & 2 deletions files/en-us/web/api/filesystemhandle/remove/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ You can also call `remove()` on the root directory of the [Origin Private File S
## Syntax

```js-nolint
remove()
remove(options)
```

Expand Down Expand Up @@ -47,7 +48,7 @@ A {{jsxref("Promise")}} that fulfills with a value of `undefined`.

## Examples

Our [FileSystemHandle.remove() demo](https://filesystemhandle-remove.glitch.me/) (see the [source code](https://glitch.com/edit/#!/filesystemhandle-remove)) is a file creator app. You can enter text into the {{htmlelement("textarea")}} and press the "Save file" {{htmlelement("button")}}, and the app will open a file picker allowing you to save that text onto your local file system in a text file of your choice. You can also choose to delete files you create.
Our [`FileSystemHandle.remove()` demo](https://filesystemhandle-remove.glitch.me/) (see the [source code](https://glitch.com/edit/#!/filesystemhandle-remove)) is a file creator app. You can enter text into the {{htmlelement("textarea")}} and press the "Save file" {{htmlelement("button")}}, and the app will open a file picker allowing you to save that text onto your local file system in a text file of your choice. You can also choose to delete files you create.

It doesn't allow you to view the content of created files, and it doesn't stay in sync with the underlying file system on page reloads/closes. This means that files created by the app will still exist on the file system if you don't choose to delete them before reloading or closing the tab.

Expand Down Expand Up @@ -83,7 +84,7 @@ Walking through this:

## Specifications

{{Specifications}}
This feature is not part of any specification, but may become standard in the future. See [_whatwg/fs#9_](https://github.com/whatwg/fs/pull/9) for the detail.

## Browser compatibility

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ file handle.
## Syntax

```js-nolint
requestPermission(fileSystemHandlePermissionDescriptor)
requestPermission(descriptor)
```

### Parameters

- FileSystemHandlePermissionDescriptor {{optional_inline}}
- `descriptor` {{optional_inline}}

- : An object which specifies the permission mode to query for. Options are as follows:

- `'mode'`: Can be either `'read'` or
`'readwrite'`.
- `'mode'` {{optional_inline}}

- : Can be either `'read'` or `'readwrite'`.

### Return value

Expand Down