UNPKG

zippycli

Version:
55 lines (54 loc) 1.49 kB
/// <reference types="node" /> import { pipeline } from 'stream'; import fse from 'fs-extra'; export declare const pipelineP: typeof pipeline.__promisify__; /** * Integer division with remained. * * @param v Value. * @param d Divisor. * @returns Integer divided and remained. */ export declare function divmod(v: number, d: number): number[]; /** * Parse date or return null is not valid. * * @param str Date string. * @returns Date object or null. */ export declare function parseDate(str: string): Date | null; /** * Get environment variable value. * * @param name Environment name. * @returns String value or null. */ export declare function env(name: string): string | null; /** * Check if the environment variable value is true. * * @param name Environment name. * @returns String value is a true-like value. */ export declare function envTrue(name: string): boolean | "" | null; /** * Stat path or return null if path does not exist. * * @param filepath File path. * @returns Stat object or null. */ export declare function fstat(filepath: string): Promise<fse.Stats | null>; /** * Read input file to list all URL's line by line. * * @param filepath Input file. * @returns URL list. */ export declare function readInputFile(filepath: string): Promise<string[]>; /** * Format date for human readable timestamps. * * @param date Date object or null. * @returns Date string. */ export declare function dateHumanTimestamp(date?: Date | null): string;