Draft: This page is not complete.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The requestPermission() method of the FileSystemHandle interface requests read or readwrite permissions for the file handle.


var PermissionState = FileSystemHandle.requestPermission(FileSystemHandlePermissionDescriptor);


FileSystemHandlePermissionDescriptor Optional

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

  • 'mode': Can be either 'read' or 'readwrite'.

Return value

PermissionStatus.state which is one of 'granted', 'denied' or 'prompt'.



No parameter is specified or the mode is not that of 'read' or 'readwrite'


The following asynchronous function requests permissions if they have not been granted.

// fileHandle is a FileSystemFileHandle
// withWrite is a boolean set to true if write

async function verifyPermission(fileHandle, withWrite) {
  const opts = {};
  if (withWrite) {
    opts.mode = 'readwrite';

  // Check if we already have permission, if so, return true.
  if (await fileHandle.queryPermission(opts) === 'granted') {
    return true;

  // Request permission to the file, if the user grants permission, return true.
  if (await fileHandle.requestPermission(opts) === 'granted') {
    return true;

  // The user did not grant permission, return false.
  return false;


File System Access
# api-filesystemhandle-requestpermission

Browser compatibility

BCD tables only load in the browser

See also