pnpm
Version:
A fast implementation of npm install
37 lines (36 loc) • 1.24 kB
TypeScript
import { Got } from '../network/got';
import { InstallLog } from '../install';
import { IncomingMessage } from 'http';
export declare type FetchOptions = {
log: InstallLog;
got: Got;
};
export declare type PackageDist = {
tarball: string;
shasum?: string;
};
export declare function createRemoteTarballFetcher(dist: PackageDist): (target: string, opts: {
log: InstallLog;
got: {
get: (url: string) => Promise<{
body: string;
}>;
getStream: (url: string) => Promise<IncomingMessage>;
getJSON<T>(url: string): Promise<T>;
};
}) => Promise<{}>;
export declare function createLocalTarballFetcher(dist: PackageDist): (target: string, opts: {
log: InstallLog;
got: {
get: (url: string) => Promise<{
body: string;
}>;
getStream: (url: string) => Promise<IncomingMessage>;
getJSON<T>(url: string): Promise<T>;
};
}) => Promise<{}>;
/**
* Fetches a tarball `tarball` and extracts it into `dir`
*/
export declare function fetchFromRemoteTarball(dir: string, dist: PackageDist, opts: FetchOptions): Promise<{}>;
export declare function fetchFromLocalTarball(dir: string, dist: PackageDist, opts: FetchOptions): Promise<{}>;