Browser extensions

View as Markdown

A Browser extension is a reusable Chromium .crx package stored by BCTRL. Import an extension from a Chrome Web Store detail URL or upload a CRX package, then reference its ID in browser Runtime configuration.

Import an extension

Import from a Chrome Web Store detail URL:

1const extension = await bctrl.browserExtensions.import({
2 url: "https://chromewebstore.google.com/detail/example/extension-id",
3 name: "Checkout helper",
4});
5
6console.log(extension.id, extension.name, extension.version);

Or upload a CRX package directly:

1const extension = await bctrl.browserExtensions.upload({
2 file: new Blob([crxBytes], { type: "application/x-chrome-extension" }),
3 name: "Checkout helper",
4});

The upload name is optional. When omitted, BCTRL uses the extension manifest name.

Load an extension in a Runtime

Pass stored extension IDs in the browser Runtime configuration:

1const runtime = await bctrl.runtimes.create({
2 config: {
3 extensionIds: [extension.id],
4 },
5});

Extensions are loaded when the browser starts. To change the extension list on a profile-backed Runtime, update its configuration while it is stopped, then start it again:

1await bctrl.runtimes.update(runtime.id, {
2 config: {
3 extensionIds: [extension.id],
4 },
5});
6
7await bctrl.runtimes.start(runtime.id);

See Runtimes for the complete browser configuration shape.

List extensions

1for await (const item of bctrl.browserExtensions.iter({
2 source: "url",
3})) {
4 console.log(item.id, item.name, item.version, item.profileCount);
5}

Available filters are:

FilterTypeDescription
qstringSearch extension metadata
format"crx"Filter by package format
source"upload" | "url"Filter by how the package was added

list() returns one cursor page. iter() follows all pages automatically.

Rename and delete

1const current = await bctrl.browserExtensions.get(extension.id);
2
3await bctrl.browserExtensions.update(extension.id, {
4 name: "Checkout automation helper",
5});
6
7await bctrl.browserExtensions.delete(extension.id);

Delete an extension when it should no longer be available to new Runtime starts. Remove it from Runtime configuration first; deletion can be rejected while the extension is still in use.

Extension fields

FieldTypeAlways presentDescription
idstringYesExtension identifier used in Runtime configuration.
namestringYesDisplay name.
versionstringYesVersion from the extension package.
format"crx"YesPackage format currently supported.
sourceUrlstringNoOriginal import URL, when imported from a URL.
sizeBytesnumberNoPackage size, when available.
contentHashstringNoSHA-256 package hash, when available.
profileCountnumberYesNumber of browser profiles using the extension.
subaccountIdstringNoSubaccount owner, when applicable.
createdAt / updatedAtstringYesTimestamps.