Skip to content

Commit a54ae91

Browse files
committed
feat: downloadExtension API
This can be used from Node, without any Electron dependencies. Keeping this undocumented for now.
1 parent 8f5f1f3 commit a54ae91

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

packages/electron-chrome-web-store/src/browser/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as path from 'path'
44
import { registerWebStoreApi } from './api'
55
import { loadAllExtensions } from './loader'
66
export { loadAllExtensions } from './loader'
7-
export { installExtension } from './installer'
7+
export { installExtension, downloadExtension } from './installer'
88
import { initUpdater } from './updater'
99
export { updateExtensions } from './updater'
1010
import { getDefaultExtensionsPath } from './utils'

packages/electron-chrome-web-store/src/browser/installer.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,13 @@ export async function downloadExtensionFromURL(
174174
}
175175
}
176176

177-
async function downloadExtension(extensionId: string, extensionsDir: string): Promise<string> {
177+
/**
178+
* Download and unpack extension to the given extensions directory.
179+
*/
180+
export async function downloadExtension(
181+
extensionId: string,
182+
extensionsDir: string,
183+
): Promise<string> {
178184
const url = getExtensionCrxURL(extensionId)
179185
return await downloadExtensionFromURL(url, extensionsDir, extensionId)
180186
}

0 commit comments

Comments
 (0)