allow setting separate timeout / max size for imports - fixes #479
This commit is contained in:
@@ -35,14 +35,14 @@ export class DownloadService {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async downloadUrl(url: string, path: string): Promise<{
|
||||
public async downloadUrl(url: string, path: string, options: { timeout?: number, operationTimeout?: number, maxSize?: number} = {} ): Promise<{
|
||||
filename: string;
|
||||
}> {
|
||||
this.logger.info(`Downloading ${chalk.cyan(url)} to ${chalk.cyanBright(path)} ...`);
|
||||
|
||||
const timeout = 30 * 1000;
|
||||
const operationTimeout = 60 * 1000;
|
||||
const maxSize = this.config.maxFileSize ?? 262144000;
|
||||
const timeout = options.timeout ?? 30 * 1000;
|
||||
const operationTimeout = options.operationTimeout ?? 60 * 1000;
|
||||
const maxSize = options.maxSize ?? this.config.maxFileSize ?? 262144000;
|
||||
|
||||
const urlObj = new URL(url);
|
||||
let filename = urlObj.pathname.split('/').pop() ?? 'untitled';
|
||||
|
||||
Reference in New Issue
Block a user