0.1.22 • Published 8 years ago
haste-task-read v0.1.22
haste-task-read
Haste task for reading files from the file system.
The task returns a promise with an array of virtual files:
- A virtual file consists of two things:
- filename
<string>- the file path relative toprocess.cwd(). - content
<string>- the content of the file encoded toutf-8. - cwd
<string>-filenameis resolved relativley to this directory.
- filename
run(read({ pattern: '**.*'}))
.then(virtualFiles => console.log(virtualFiles))
// [{ filename: "./realtive/path/to/file.js", content: "file content"}]options
pattern
Type: String|Array<String>
A glob pattern(s) to be matched against.
options
Type: Object
Customization object for glob matching.
Note: This task uses globby under the hood. Please see it's documentation to see the available patterns and options.