setup-php/src/pecl.ts

18 lines
497 B
TypeScript
Raw Normal View History

2019-09-20 09:41:20 +07:00
import * as hc from 'typed-rest-client/HttpClient';
/**
* Function to check if PECL extension exists
*
* @param extension
*/
export async function checkPECLExtension(extension: string): Promise<boolean> {
const http: hc.HttpClient = new hc.HttpClient('shivammathur/php-setup', [], {
allowRetries: true,
maxRetries: 2
});
const response: hc.HttpClientResponse = await http.get(
'https://pecl.php.net/package/' + extension
);
return response.message.statusCode === 200;
}