UNPKG

2.52 kBTypeScriptView Raw
1/// <reference types="node" resolution-mode="require"/>
2/**
3 * Join all arguments together and normalize the resulting path. Arguments must be
4 * strings. Using Node.js built-in path.posix.join().
5 * Which forces use of Posix path separators, '/'.
6 *
7 * @param {...string} paths
8 * @returns {string}
9 */
10export function pathJoin(...paths: string[]): string;
11/**
12 * Wrap around Node.js child_process#exec. Resolving when the sub process has exited. The
13 * resulting object contains the 'exitCode' of the sub process.
14 *
15 * @since 0.1.0
16 *
17 * @param {string} command
18 * @param {import("child_process").ExecOptions} [opts={}]
19 * @returns {Promise<{stdout: string, stderr: string, exitCode: number}>}
20 */
21export function exec(command: string, opts?: import("child_process").ExecOptions | undefined): Promise<{
22 stdout: string;
23 stderr: string;
24 exitCode: number;
25}>;
26/**
27 * Wrap around Node.js child_process#spawn. Resolving when the sub process has exited. The
28 * resulting object contains the 'exitCode' of the sub process.
29 * By default 'stdio' is inherited from the current process.
30 *
31 * @since 0.1.0
32 *
33 * @param {string} command
34 * @param {string[]} args
35 * @param {import("child_process").SpawnOptions} [opts={}]
36 * @returns {Promise<{exitCode: number}>}
37 */
38export function spawn(command: string, args: string[], opts?: import("child_process").SpawnOptions | undefined): Promise<{
39 exitCode: number;
40}>;
41/**
42 * Read a readable stream completely, and return as Buffer
43 *
44 * @since 0.1.0
45 *
46 * @param {NodeJS.ReadableStream} stream
47 * @returns {Promise<Buffer>}
48 */
49export function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer>;
50/**
51 * Recursively act on all files in a directory, awaiting on callback calls.
52 *
53 * @since 0.1.0
54 *
55 * @param {string} dir
56 * @param {(file: string) => (void|Promise<void>)} cb
57 * @param {import("../types/advanced-types.js").ProcessDirectoryOptions} [opts]
58 */
59export function processDirectoryRecursive(dir: string, cb: (file: string) => (void | Promise<void>), opts?: import("../types/advanced-types.js").ProcessDirectoryOptions | undefined): Promise<void>;
60/**
61 * Sync version of processDirectoryRecursive
62 *
63 * @since 0.1.0
64 *
65 * @param {string} dir
66 * @param {(file: string) => (void)} cb
67 * @param {import("../types/advanced-types.js").ProcessDirectoryOptions} [opts]
68 */
69export function processDirectoryRecursiveSync(dir: string, cb: (file: string) => (void), opts?: import("../types/advanced-types.js").ProcessDirectoryOptions | undefined): void;