Files
azuredatastudio/src/vs/platform/extensionManagement/node/extensionManagementUtil.ts
2019-03-15 13:09:45 -07:00

19 lines
843 B
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { buffer } from 'vs/platform/node/zip';
import { localize } from 'vs/nls';
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
export function getManifest(vsix: string): Promise<IExtensionManifest> {
return buffer(vsix, 'extension/package.json')
.then(buffer => {
try {
return JSON.parse(buffer.toString('utf8'));
} catch (err) {
throw new Error(localize('invalidManifest', "VSIX invalid: package.json is not a JSON file."));
}
});
}