runtime.getPackageDirectoryEntry()

Gets a DirectoryEntry object representing the package directory.

This is an asynchronous function that either takes a callback or returns a promise.

Note: The promise-based API is supported in Manifest V3 and later.

Syntax

js
browser.runtime.getPackageDirectoryEntry(
  callback              // optional callback function
)

Parameters

callback Optional

function. If provided, the function will be passed a DirectoryEntry object. If absent, the function returns a promise instead.

Return value

None (undefined) if a callback is provided. Otherwise, returns a Promise that will be fulfilled with a DirectoryEntry object representing the package directory.

Examples

js
browser.runtime.getPackageDirectoryEntry((directoryEntry) => {
  console.log(directoryEntry);
});

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Firefox for Android
Safari on iOS
getPackageDirectoryEntry
Chrome – Full support
Chrome 29 (Release date: 2013-08-20)
footnote Full support
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 16 (Release date: 2013-08-27)
footnote Full support
Safari – No support
Safari
footnote No support
Firefox for Android – No support
Firefox for Android
footnote No support
Safari on iOS – No support
Safari on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Note: This API is based on Chromium's chrome.runtime API. This documentation is derived from runtime.json in the Chromium code.