UNPKG

@devteks/downloader

Version:
17 lines (16 loc) 1.26 kB
/// <reference types="node" /> import { WriteStream } from 'fs'; import { IncomingMessage, RequestOptions, IncomingHttpHeaders } from 'http'; import { RequestMethod, DownloadState, FilenameOptions } from './types'; export declare function validateParams(url: string, destFolder: string): boolean; export declare function getContentLength(response: IncomingMessage | null | undefined): number | null; export declare function canAccessFile(path: string): Promise<boolean>; export declare function closeStream(stream: WriteStream, throwErrors?: boolean): Promise<boolean>; export declare function getUniqueFileName(path: string): string; export declare function getRequestOptions(method: RequestMethod | undefined, url: string, headers?: any): RequestOptions; export declare function isFinishedState(state: DownloadState): boolean; export declare function getRedirectUrl(response: IncomingMessage, url: string): string | null; export declare function getFileNameFromOptions(fileName: string, fname: FilenameOptions): string; export declare function getFilenameFromContentDisposition(headers: IncomingHttpHeaders): string | undefined; export declare function delay(ms: number): Promise<void>; export declare function format(s: string): string;