@wpkernel/cli / QuickstartDependencies
Interface: QuickstartDependencies
Properties
access()
readonly access: (path, mode?) => Promise<void>;Tests a user's permissions for the file or directory specified by path. The mode argument is an optional integer that specifies the accessibility checks to be performed. mode should be either the value fs.constants.F_OK or a mask consisting of the bitwise OR of any of fs.constants.R_OK, fs.constants.W_OK, and fs.constants.X_OK (e.g.fs.constants.W_OK | fs.constants.R_OK). Check File access constants for possible values of mode.
If the accessibility check is successful, the promise is fulfilled with no value. If any of the accessibility checks fail, the promise is rejected with an Error object. The following example checks if the file/etc/passwd can be read and written by the current process.
import { access, constants } from 'node:fs/promises';
try {
await access('/etc/passwd', constants.R_OK | constants.W_OK);
console.log('can access');
} catch {
console.error('cannot access');
}Using fsPromises.access() to check for the accessibility of a file before calling fsPromises.open() is not recommended. Doing so introduces a race condition, since other processes may change the file's state between the two calls. Instead, user code should open/read/write the file directly and handle the error raised if the file is not accessible.
Parameters
path
PathLike
mode?
number
Returns
Promise<void>
Fulfills with undefined upon success.
Since
v10.0.0
exec()
readonly exec: {
(file): PromiseWithChild<{
}>;
(file, args): PromiseWithChild<{
}>;
(file, options): PromiseWithChild<{
}>;
(file, args, options): PromiseWithChild<{
}>;
(file, options): PromiseWithChild<{
}>;
(file, args, options): PromiseWithChild<{
}>;
(file, options): PromiseWithChild<{
}>;
(file, args, options): PromiseWithChild<{
}>;
};Call Signature
(file): PromiseWithChild<{
}>;Parameters
file
string
Returns
PromiseWithChild<{ }>
Call Signature
(file, args): PromiseWithChild<{
}>;Parameters
file
string
args
readonly string[] | null | undefined
Returns
PromiseWithChild<{ }>
Call Signature
(file, options): PromiseWithChild<{
}>;Parameters
file
string
options
ExecFileOptionsWithBufferEncoding
Returns
PromiseWithChild<{ }>
Call Signature
(
file,
args,
options): PromiseWithChild<{
}>;Parameters
file
string
args
readonly string[] | null | undefined
options
ExecFileOptionsWithBufferEncoding
Returns
PromiseWithChild<{ }>
Call Signature
(file, options): PromiseWithChild<{
}>;Parameters
file
string
options
ExecFileOptionsWithStringEncoding
Returns
PromiseWithChild<{ }>
Call Signature
(
file,
args,
options): PromiseWithChild<{
}>;Parameters
file
string
args
readonly string[] | null | undefined
options
ExecFileOptionsWithStringEncoding
Returns
PromiseWithChild<{ }>
Call Signature
(file, options): PromiseWithChild<{
}>;Parameters
file
string
options
ExecFileOptions | null | undefined
Returns
PromiseWithChild<{ }>
Call Signature
(
file,
args,
options): PromiseWithChild<{
}>;Parameters
file
string
args
readonly string[] | null | undefined
options
ExecFileOptions | null | undefined
Returns
PromiseWithChild<{ }>
mkdtemp()
readonly mkdtemp: {
(prefix, options?): Promise<string>;
(prefix, options): Promise<NonSharedBuffer>;
(prefix, options?): Promise<string | NonSharedBuffer>;
};Call Signature
(prefix, options?): Promise<string>;Creates a unique temporary directory. A unique directory name is generated by appending six random characters to the end of the provided prefix. Due to platform inconsistencies, avoid trailing X characters in prefix. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing X characters in prefix with random characters.
The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.
import { mkdtemp } from 'node:fs/promises';
import { join } from 'node:path';
import { tmpdir } from 'node:os';
try {
await mkdtemp(join(tmpdir(), 'foo-'));
} catch (err) {
console.error(err);
}The fsPromises.mkdtemp() method will append the six randomly selected characters directly to the prefix string. For instance, given a directory /tmp, if the intention is to create a temporary directory within /tmp, the prefix must end with a trailing platform-specific path separator (import { sep } from 'node:path').
Parameters
prefix
string
options?
ObjectEncodingOptions | BufferEncoding | null
Returns
Promise<string>
Fulfills with a string containing the file system path of the newly created temporary directory.
Since
v10.0.0
Call Signature
(prefix, options): Promise<NonSharedBuffer>;Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
Parameters
prefix
string
options
BufferEncodingOption
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.
Returns
Promise<NonSharedBuffer>
Call Signature
(prefix, options?): Promise<string | NonSharedBuffer>;Asynchronously creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
Parameters
prefix
string
options?
The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, 'utf8' is used.
ObjectEncodingOptions | BufferEncoding | null
Returns
Promise<string | NonSharedBuffer>
resolve()
readonly resolve: (id, opts?) => string;Parameters
id
string
opts?
paths?
string[]
Returns
string
rm()
readonly rm: (path, options?) => Promise<void>;Removes files and directories (modeled on the standard POSIX rm utility).
Parameters
path
PathLike
options?
RmOptions
Returns
Promise<void>
Fulfills with undefined upon success.
Since
v14.14.0
