haste-task-read
v0.1.22
Published
Haste task for reading files from the file system.
Downloads
2
Readme
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>
-filename
is 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.