Apollo-datasource-rest to download a pdf file (gzip encoded) and save it in local

I try to call a rest api which returns a file response with Content-Type: application/pdf and Content-Encoding: gzip

How do I download this file and can open from local drive?

I use following code:

import { RequestOptions, RESTDataSource } from 'apollo-datasource-rest';
import * as fs from 'fs';

export class DocumentManagementService extends RESTDataSource {

    async downloadDocument(id: string): Promise<any> {
        const response = await this.get<any>(
            `/documents/${id}/download`,
            undefined,
            {}
        );

        fs.writeFileSync('test.pdf', response, 'binary');

    }
}

Can somebody help me to download this file?