UNPKG

npmshit

Version:

自动清理node_modules中无用的文件

25 lines (24 loc) 882 B
/// <reference types="node" /> import fs from "fs"; export interface IResult { totalSize: number; size: number; packageFreeSize: number; packageCount: number; fileCount: number; fileList: string[]; dirList: string[]; packageFileList: string[]; removeFiles: string[]; } export declare type Callback = (err: Error | null, res: IResult) => void; export declare const unlinkAsync: typeof fs.unlink.__promisify__; export declare const rmdirAsync: typeof fs.rmdir.__promisify__; export declare const statAsync: typeof fs.stat.__promisify__; export declare function rmdir(dir: string): Promise<void>; export declare function humanFileSize(size: number): string; export declare function listFiles(base: string): Promise<IResult>; export declare function reducePackageJson(name: string, write?: boolean): { size: number; removeFiles: string[]; };