UNPKG

zippycli

Version:
79 lines (78 loc) 2.33 kB
/// <reference types="node" /> import { flags } from '@oclif/command'; import fse from 'fs-extra'; import { Command } from '../command'; import { IRequestFactory } from '../request'; /** * Download command. */ export declare class Download extends Command { /** * Aliases. */ static readonly aliases: string[]; /** * Description. */ static readonly description = "download file from source"; /** * Examples. */ static readonly examples: never[]; /** * Flags. */ static readonly flags: { help: import("@oclif/parser/lib/flags").IBooleanFlag<void>; output: flags.IOptionFlag<string | undefined>; dir: flags.IOptionFlag<string | undefined>; input: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; mtime: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>; timeout: import("@oclif/parser/lib/flags").IOptionFlag<number>; update: import("@oclif/parser/lib/flags").IOptionFlag<number>; }; /** * Arguments. */ static readonly args: { name: string; required: boolean; description: string; }[]; /** * Handler. */ run(): Promise<void>; /** * Handle an individual source. * * @param source The source. * @param outdir Output dir. * @param outfile Output files. * @param mtime Modification time. * @param updateInterval Update interval. * @param req Request factory. */ protected _handleSource(source: string, outdir: string, outfile: string, mtime: boolean, updateInterval: number, req: IRequestFactory): Promise<void>; /** * Download file to a file stream. * * @param file File stream. * @param url Download URL. * @param req Request factory. * @param resume Resume offset. * @returns Stream object and a complete promise. */ protected _download(file: fse.WriteStream, url: string, req: IRequestFactory, resume: number): { stream: import("../request").IRequestStream; complete: Promise<void>; }; /** * Get a partial name from filename. * * @param filename The filename. * @returns Partial name. */ protected _partialFilename(filename: string): string; } export default Download;