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.

Browser compatibility

BCD tables only load in the browser

Examples

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

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