panto-file-utils
File utils for panto.
You can locate/read file(s) ONLY in src directory, but mkdir/write/remove ONLY in output directory.
const PantoOptions = ;const FileUtils = ; const fu = cwd: '.' src: 'src' output: 'out'; fu// truefu// false // locate only in SRCfu// ./src/foo/a.js // touch only in OUTPUTfu// ./out/foo/a.js // read from only SRCfu// ./src/foo/a.js // write to only OUTPUTfu // ./out/foo/b.js // remove from only OUTPUT,alias unlink/removefu // ./out/foo/b.js // mkdir only in OUTPUTfu// ./out/bar/ fu// ./out/bar/ // Alias for multimatchfu
apis
- isBinary(filename): Boolean, if it's a binary file type.
- locate(filename): Promise, return a file path under ${cwd}/${src}.
- touch(filename): Promise, return a file path under ${cwd}/${output}.
- safeDirp(filename): Promise, make sure file's directories exist.
- read(filename): Promise, read a file under ${cwd}/${src}.
- write(filename, content): Promise, write a file under ${cwd}/${output}.
- match(filename, pattern): Promise, alias as multimatch.
- remove(filename): Promise, remove a file or directory under ${cwd}/${output}.
- unlink: Alias for remove.
- rimraf: Alias for remove.
- copy: Promise, copy from ${cwd}/${src} to ${cwd}/${output}.