mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
18 lines
497 B
TypeScript
18 lines
497 B
TypeScript
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;
|
|
}
|