qqjs
- Version 0.3.11
- Published
- 23.5 kB
- 13 dependencies
- MIT license
Install
npm i qqjs
yarn add qqjs
pnpm add qqjs
Overview
useful functions for writing node scripts
Index
Variables
Functions
Type Aliases
Namespaces
Variables
Functions
function cd
cd: (filepaths: string | string[]) => void;
cd into a directory
function chmod
chmod: (filepath: string | string[], mode: number) => Promise<void>;
function cp
cp: ( source: string | string[], destinationpaths: string | string[], options?: {}) => Promise<void>;
copy files with fs.copy can copy directories
function cwd
cwd: () => string;
function download
download: ( url: string, filepath?: string | string[]) => Promise<execa.ExecaReturns>;
function emptyDir
emptyDir: (filepath: string | string[]) => Promise<void>;
function exists
exists: typeof exists;
function fileType
fileType: ( fp: string | string[]) => Promise<'file' | 'directory' | 'symlink' | undefined>;
function globby
globby: ( patterns: string | string[], options?: Globby.GlobbyOptions) => Promise<string[]>;
glob matcher (find files)
function handleError
handleError: (err: Error) => void;
function hash
hash: (algo: string, fp: string | string[]) => Promise<string>;
function join
join: { (filepath?: string | string[]): string; (...filepath: string[]): string;};
easier to use version of path.join() flattens args so you can pass things in like join(['foo', 'bar']) or join('foo', 'bar') the point of this is to make it so all the different qqjs tools can take in arrays as arguments to be joined defaults to process.cwd()
function ln
ln: (from: Filepath, to: Filepath) => Promise<void>;
function log
log: (...args: any[]) => void;
function ls
ls: ( filepaths?: string | string[], options?: { fullpath?: boolean }) => Promise<string[]>;
list files in directory
function mkdirp
mkdirp: typeof mkdirp;
creates a directory if it does not exist this will automatically join the paths if you pass multiple strings with path.join()
function mv
mv: (source: string | string[], dest: string | string[]) => Promise<void>;
function pkgDir
pkgDir: typeof pkgDir;
function popd
popd: () => void;
function prettifyPaths
prettifyPaths: (input: string) => string;
function pushd
pushd: (filepaths: string | string[]) => void;
function read
read: (filepaths: string | string[], options?: {}) => Promise<string>;
read file into string
function readJSON
readJSON: (filepaths: string | string[]) => Promise<any>;
reads a json file in using load-json-file this will automatically join the paths if you pass multiple strings with path.join() can accept http urls
function rm
rm: (...filesArray: (string | string[])[]) => Promise<void>;
rm -rf
function rmIfEmpty
rmIfEmpty: (...filesArray: (string | string[])[]) => Promise<void>;
function run
run: <T>(fn: (...args: any[]) => Promise<T>) => Promise<T | void>;
function tmpDir
tmpDir: () => Promise<string>;
create a new temporary directory uses tmp
function write
write: (filepaths: string | string[], data: any, options?: {}) => Promise<void>;
output string to file creates directory if not exists
function writeJSON
writeJSON: ( filepaths: string | string[], data: any, options?: WriteJSONFile.Options) => Promise<void>;
writes a json file with write-json-file this will automatically join the paths if you pass an array of strings
function x
x: typeof x;
run a command
pass in a string to have it run with execa.shell(), or an file and array of strings for execa()
Type Aliases
type Filepath
type Filepath = string | string[];
Namespaces
Package Files (10)
Dependencies (13)
Dev Dependencies (14)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/qqjs
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/qqjs)
- HTML<a href="https://www.jsdocs.io/package/qqjs"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 1620 ms. - Missing or incorrect documentation? Open an issue for this package.