web api instance method
FileSystemDirectoryHandle: removeEntry() method
Secure contextAvailable in workers
The removeEntry() method of the
FileSystemDirectoryHandle interface attempts to remove an entry if the
directory handle contains a file or directory called the name specified.
Syntax
removeEntry(name)
removeEntry(name, options)
Parameters
name- : A string representing the
nameof the entry you wish to remove.
- : A string representing the
optionsOptional- : An optional object containing options, which are as follows:
recursiveOptional- : A boolean value, which defaults to
false. When set totrueentries will be removed recursively.
- : A boolean value, which defaults to
- : An optional object containing options, which are as follows:
Return value
A Promise which resolves with undefined.
Exceptions
TypeError- : Thrown if the name is not a valid string or contains characters not allowed on the file system.
NotAllowedErrorDOMException- : Thrown if the
statefor the handle is not'granted'inreadwritemode.
- : Thrown if the
InvalidModificationErrorDOMException- : Thrown if
recursiveis set to false and the entry to be removed has children.
- : Thrown if
NotFoundErrorDOMException- : Thrown if the current entry is not found or if the entry of the specific name is not found or matched.
Examples
The following example removes an entry within the directory handle.
const entryName = "entryToRemove";
// assuming we have a directory handle: 'currentDirHandle'
currentDirHandle.removeEntry(entryName).then(() => {
// code to run if removing was successful
});
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.