@@ -25,12 +25,12 @@ npm install to-vfile
25
25
## Use
26
26
27
27
``` js
28
- import {toVFile } from ' to-vfile'
28
+ import {toVFile , readSync } from ' to-vfile'
29
29
30
30
console .log (toVFile (' readme.md' ))
31
31
console .log (toVFile (new URL (' ./readme.md' , import .meta.url)))
32
- console .log (toVFile . readSync (' .git/HEAD' ))
33
- console .log (toVFile . readSync (' .git/HEAD' , ' utf8' ))
32
+ console .log (readSync (' .git/HEAD' ))
33
+ console .log (readSync (' .git/HEAD' , ' utf8' ))
34
34
` ` `
35
35
36
36
Yields:
@@ -66,7 +66,8 @@ VFile {
66
66
67
67
## API
68
68
69
- This package exports the following identifiers: ` toVFile` .
69
+ This package exports the following identifiers: ` toVFile` , ` read` , ` readSync` ,
70
+ ` write` , and ` writeSync` .
70
71
There is no default export.
71
72
72
73
### ` toVFile (options)`
@@ -77,7 +78,7 @@ Works like the [vfile][] constructor, except when `options` is `string` or
77
78
` {value: options}` , or when ` options` is a WHATWG ` URL ` object, in which case
78
79
it’s treated as ` {path: fileURLToPath (options)}` .
79
80
80
- ### ` toVFile . read (options[, encoding][, callback])`
81
+ ### ` read (options[, encoding][, callback])`
81
82
82
83
Creates a virtual file from options (` toVFile (options)` ), reads the file from
83
84
the file system and populates ` file .value ` with the result.
@@ -87,12 +88,12 @@ file.
87
88
If ` callback` is not given, returns a [` Promise ` ][promise] that is rejected with
88
89
an error or resolved with the populated virtual file.
89
90
90
- ### ` toVFile . readSync (options[, encoding])`
91
+ ### ` readSync (options[, encoding])`
91
92
92
- Like ` toVFile . read ` but synchronous.
93
+ Like ` read` but synchronous.
93
94
Either throws an error or returns a populated virtual file.
94
95
95
- ### ` toVFile . write (options[, fsOptions][, callback])`
96
+ ### ` write (options[, fsOptions][, callback])`
96
97
97
98
Creates a virtual file from ` options` (` toVFile (options)` ), writes the file to
98
99
the file system.
@@ -101,9 +102,9 @@ If `callback` is given, invokes it with an error, if any.
101
102
If ` callback` is not given, returns a [` Promise ` ][promise] that is rejected with
102
103
an error or resolved with the written virtual file.
103
104
104
- ### ` toVFile . writeSync (options[, fsOptions])`
105
+ ### ` writeSync (options[, fsOptions])`
105
106
106
- Like ` toVFile . write ` but synchronous.
107
+ Like ` write` but synchronous.
107
108
Either throws an error or returns a populated virtual file.
108
109
109
110
## Contribute
0 commit comments