UNPKG

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