mirror of
https://github.com/actions/http-client.git
synced 2025-04-21 09:42:29 +00:00
Update util.ts
Co-Authored-By: Chris Sidi <hashtagchris@github.com>
This commit is contained in:
parent
caaeba59c2
commit
84a47354fb
6
util.ts
6
util.ts
@ -9,8 +9,8 @@ import {IHttpClientResponse} from './interfaces'
|
||||
* @param {string} charset
|
||||
* @return {Promise<string>}
|
||||
*/
|
||||
export async function decompressGzippedContent(buffer: Buffer, charset: string): Promise<string> {
|
||||
return new Promise<string>(async (resolve, reject) => {
|
||||
export function decompressGzippedContent(buffer: Buffer, charset: string): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
zlib.gunzip(buffer, function (error, buffer) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
@ -41,4 +41,4 @@ export function obtainContentCharset (response: IHttpClientResponse) : string {
|
||||
const matches: (RegExpMatchArray|null) = contentType.match(/charset=([^;,\r\n]+)/i);
|
||||
|
||||
return (matches && matches[1]) ? matches[1] : 'utf-8';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user