Update util.ts

Co-Authored-By: Chris Sidi <hashtagchris@github.com>
This commit is contained in:
Konrad Pabjan 2020-04-01 15:39:08 +02:00 committed by GitHub
parent caaeba59c2
commit 84a47354fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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';
}
}