Skip to content

Commit

Permalink
feat: pass in downloader options to got (#90)
Browse files Browse the repository at this point in the history
* feat: add request options for GotDownloader

* got expects any according to the source code 🤷
  • Loading branch information
malept authored and MarshallOfSound committed May 27, 2019
1 parent eb17013 commit 0a64fd4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GotDownloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as path from 'path';

import { Downloader } from './Downloader';

export class GotDownloader implements Downloader<null> {
async download(url: string, targetFilePath: string) {
export class GotDownloader implements Downloader<any> {
async download(url: string, targetFilePath: string, options?: any) {
await fs.mkdirp(path.dirname(targetFilePath));
const writeStream = fs.createWriteStream(targetFilePath);
await new Promise((resolve, reject) => {
const downloadStream = got.stream(url);
const downloadStream = got.stream(url, options);
downloadStream.pipe(writeStream);

downloadStream.on('error', error => reject(error));
Expand Down

0 comments on commit 0a64fd4

Please sign in to comment.