33
33
34
34
## What is this?
35
35
36
- This utility places file paths and the file system first.
36
+ This utility puts the file system first.
37
37
Where ` vfile ` itself focusses on file values (the file contents), this instead
38
- focuses on the file system, which is a common case when working with files.
38
+ focuses on the file system, which is a common case when working with * actual*
39
+ files from Node.js.
39
40
40
41
## When should I use this?
41
42
@@ -45,7 +46,7 @@ Use `vfile` if there might not be a file system.
45
46
## Install
46
47
47
48
This package is [ ESM only] [ esm ] .
48
- In Node.js (version 14.14+ and 16.0 +), install with [ npm] [ ] :
49
+ In Node.js (version 16 +), install with [ npm] [ ] :
49
50
50
51
``` sh
51
52
npm install to-vfile
@@ -80,29 +81,29 @@ Yields:
80
81
81
82
` ` ` js
82
83
VFile {
84
+ cwd: ' /Users/tilde/Projects/oss/to-vfile' ,
83
85
data: {},
84
- messages: [],
85
86
history: [ ' readme.md' ],
86
- cwd : ' /Users/tilde/Projects/oss/to-vfile '
87
+ messages : []
87
88
}
88
89
VFile {
90
+ cwd: ' /Users/tilde/Projects/oss/to-vfile' ,
89
91
data: {},
90
- messages: [],
91
92
history: [ ' /Users/tilde/Projects/oss/to-vfile/readme.md' ],
92
- cwd : ' /Users/tilde/Projects/oss/to-vfile '
93
+ messages : []
93
94
}
94
95
VFile {
96
+ cwd: ' /Users/tilde/Projects/oss/to-vfile' ,
95
97
data: {},
96
- messages: [],
97
98
history: [ ' .git/HEAD' ],
98
- cwd : ' /Users/tilde/Projects/oss/to-vfile ' ,
99
+ messages : [] ,
99
100
value: < Buffer 72 65 66 3a 20 72 65 66 73 2f 68 65 61 64 73 2f 6d 61 69 6e 0a >
100
101
}
101
102
VFile {
103
+ cwd: ' /Users/tilde/Projects/oss/to-vfile' ,
102
104
data: {},
103
- messages: [],
104
105
history: [ ' .git/HEAD' ],
105
- cwd : ' /Users/tilde/Projects/oss/to-vfile ' ,
106
+ messages : [] ,
106
107
value: ' ref: refs/heads/main\n '
107
108
}
108
109
` ` `
@@ -213,7 +214,7 @@ Given file or new file ([`VFile`][vfile]).
213
214
214
215
Encodings supported by the buffer class (TypeScript type).
215
216
216
- This is a copy of the types from Node and [ ` VFile ` ][vfile] .
217
+ This is a copy of the types from Node.
217
218
218
219
###### Type
219
220
@@ -254,12 +255,10 @@ URL to file, path to file, options for file, or actual file (TypeScript type).
254
255
###### Type
255
256
256
257
` ` ` ts
257
- type Compatible = Buffer | URL | VFileOptions | VFile | string
258
+ type Compatible = Uint8Array | URL | VFile | VFileOptions | string
258
259
` ` `
259
260
260
- <!-- To do: fix link to ` VFileOptions` when ` VFile` is updated -->
261
-
262
- See [` VFileOptions` ][vfile] and [` VFile` ][vfile].
261
+ See [` VFileOptions` ][vfile-options] and [` VFile` ][vfile].
263
262
264
263
### ` ReadOptions`
265
264
@@ -268,7 +267,7 @@ Configuration for `fs.readFile` (TypeScript type).
268
267
###### Fields
269
268
270
269
* ` encoding` ([` BufferEncoding` ][api-buffer-encoding], optional)
271
- — encoding to read file as, will turn ` file .value ` into a string if passed
270
+ — encoding to read file as, will turn ` file .value ` into a ` string` if passed
272
271
* ` flag` (` string` , optional)
273
272
— file system flags to use
274
273
@@ -279,7 +278,7 @@ Configuration for `fs.writeFile` (TypeScript type).
279
278
###### Fields
280
279
281
280
* ` encoding` ([` BufferEncoding` ][api-buffer-encoding], optional)
282
- — encoding to write file as
281
+ — encoding to write file as when ` file . value ` is a ` string `
283
282
* ` mode` (` number | string` , optional)
284
283
— file mode (permission and sticky bits) if the file was newly created
285
284
* ` flag` (` string` , optional)
@@ -297,10 +296,13 @@ It exports the additional types
297
296
298
297
## Compatibility
299
298
300
- Projects maintained by the unified collective are compatible with all maintained
299
+ Projects maintained by the unified collective are compatible with maintained
301
300
versions of Node.js.
302
- As of now, that is Node.js 14.14+ and 16.0+.
303
- Our projects sometimes work with older versions, but this is not guaranteed.
301
+
302
+ When we cut a new major release, we drop support for unmaintained versions of
303
+ Node.
304
+ This means we try to keep the current release line, ` vfile@^ 7 ` ,
305
+ compatible with Node.js 12.
304
306
305
307
## Contribute
306
308
@@ -362,6 +364,8 @@ abide by its terms.
362
364
363
365
[vfile]: https://github.com/vfile/vfile
364
366
367
+ [vfile-options]: https://github.com/vfile/vfile#options
368
+
365
369
[promise]: https://developer.mozilla.org/Web/JavaScript/Reference/Global_Objects/Promise
366
370
367
371
[api-read]: #readdescription-options-callback
0 commit comments