Skip to content

Commit

Permalink
feat: downloadExtension API
Browse files Browse the repository at this point in the history
This can be used from Node, without any Electron dependencies. Keeping this undocumented for now.
  • Loading branch information
samuelmaddock committed Dec 23, 2024
1 parent 8f5f1f3 commit a54ae91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/electron-chrome-web-store/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path'
import { registerWebStoreApi } from './api'
import { loadAllExtensions } from './loader'
export { loadAllExtensions } from './loader'
export { installExtension } from './installer'
export { installExtension, downloadExtension } from './installer'
import { initUpdater } from './updater'
export { updateExtensions } from './updater'
import { getDefaultExtensionsPath } from './utils'
Expand Down
8 changes: 7 additions & 1 deletion packages/electron-chrome-web-store/src/browser/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ export async function downloadExtensionFromURL(
}
}

async function downloadExtension(extensionId: string, extensionsDir: string): Promise<string> {
/**
* Download and unpack extension to the given extensions directory.
*/
export async function downloadExtension(
extensionId: string,
extensionsDir: string,
): Promise<string> {
const url = getExtensionCrxURL(extensionId)
return await downloadExtensionFromURL(url, extensionsDir, extensionId)
}
Expand Down

0 comments on commit a54ae91

Please sign in to comment.