From 9623e8aa627ba608b6347f71b61e81e2655029cb Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 24 Jan 2023 01:00:09 +0000 Subject: [PATCH] no got --- packages/backend/src/core/DownloadService.ts | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/backend/src/core/DownloadService.ts b/packages/backend/src/core/DownloadService.ts index cf76668329..1894dd928c 100644 --- a/packages/backend/src/core/DownloadService.ts +++ b/packages/backend/src/core/DownloadService.ts @@ -4,7 +4,6 @@ import * as util from 'node:util'; import { Inject, Injectable } from '@nestjs/common'; import IPCIDR from 'ip-cidr'; import PrivateIp from 'private-ip'; -import got, * as Got from 'got'; import chalk from 'chalk'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; @@ -83,16 +82,8 @@ export class DownloadService { throw new StatusError('No body', 400, 'No body'); } - try { - this.logger.info(`Saving File to ${chalk.cyanBright(path)} from downloading ...`); - await pipeline(stream.Readable.fromWeb(response.body), fs.createWriteStream(path)); - } catch (e) { - if (e instanceof Got.HTTPError) { - throw new StatusError(`${e.response.statusCode} ${e.response.statusMessage}`, e.response.statusCode, e.response.statusMessage); - } else { - throw e; - } - } + this.logger.info(`Saving File to ${chalk.cyanBright(path)} from downloading ...`); + await pipeline(stream.Readable.fromWeb(response.body), fs.createWriteStream(path)); } @bindThis