new VFile(
value
?):VFile
Create a new virtual file.
options
is treated as:
string
or Uint8Array
— {value: options}
URL
— {path: options}
VFile
— shallow copies its data over to the new fileobject
— all fields are shallow copied over to the new filePath related fields are set in the following order (least specific to
most specific): history
, path
, basename
, stem
, extname
,
dirname
.
You cannot set dirname
or extname
without setting either history
,
path
, basename
, or stem
too.
Parameter | Type | Description |
---|---|---|
value ? | null | Compatible | File value. |
New instance.
node_modules/vfile/lib/index.d.ts:24
cwd:
string
Base of path
(default: process.cwd()
or '/'
in browsers).
node_modules/vfile/lib/index.d.ts:30
data:
Data
Place to store custom info (default: {}
).
It’s OK to store custom data directly on the file but moving it to
data
is recommended.
node_modules/vfile/lib/index.d.ts:39
history:
string
[]
List of file paths the file moved between.
The first is the original path and the last is the current path.
node_modules/vfile/lib/index.d.ts:47
map:
undefined
|null
|Map
Source map.
This type is equivalent to the RawSourceMap
type from the source-map
module.
node_modules/vfile/lib/index.d.ts:68
messages:
VFileMessage
[]
List of messages associated with the file.
node_modules/vfile/lib/index.d.ts:53
result:
unknown
Custom, non-string, compiled, representation.
This is used by unified to store non-string results. One example is when turning markdown into React nodes.
node_modules/vfile/lib/index.d.ts:77
stored:
boolean
Whether a file was saved to disk.
This is used by vfile reporters.
node_modules/vfile/lib/index.d.ts:85
value:
Value
Raw value.
node_modules/vfile/lib/index.d.ts:59
get basename():
undefined
|string
Get the basename (including extname) (example: 'index.min.js'
).
undefined
| string
Basename.
set basename(
basename
):void
Set basename (including extname) ('index.min.js'
).
Cannot contain path separators ('/'
on unix, macOS, and browsers, '\'
on windows).
Cannot be nullified (use file.path = file.dirname
instead).
Parameter | Type | Description |
---|---|---|
basename | string | Basename. |
void
Nothing.
node_modules/vfile/lib/index.d.ts:105
get dirname():
undefined
|string
Get the parent path (example: '~'
).
undefined
| string
Dirname.
set dirname(
dirname
):void
Set the parent path (example: '~'
).
Cannot be set if there’s no path
yet.
Parameter | Type | Description |
---|---|---|
dirname | undefined | string | Dirname. |
void
Nothing.
node_modules/vfile/lib/index.d.ts:143
get extname():
undefined
|string
Get the extname (including dot) (example: '.js'
).
undefined
| string
Extname.
set extname(
extname
):void
Set the extname (including dot) (example: '.js'
).
Cannot contain path separators ('/'
on unix, macOS, and browsers, '\'
on windows).
Cannot be set if there’s no path
yet.
Parameter | Type | Description |
---|---|---|
extname | undefined | string | Extname. |
void
Nothing.
node_modules/vfile/lib/index.d.ts:163
get path():
string
Get the full path (example: '~/index.min.js'
).
string
Path.
set path(
path
):void
Set the full path (example: '~/index.min.js'
).
Cannot be nullified.
You can set a file URL (a URL
object with a file:
protocol) which will
be turned into a path with url.fileURLToPath
.
Parameter | Type | Description |
---|---|---|
path | string | URL | Path. |
void
Nothing.
node_modules/vfile/lib/index.d.ts:125
get stem():
undefined
|string
Get the stem (basename w/o extname) (example: 'index.min'
).
undefined
| string
Stem.
set stem(
stem
):void
Set the stem (basename w/o extname) (example: 'index.min'
).
Cannot contain path separators ('/'
on unix, macOS, and browsers, '\'
on windows).
Cannot be nullified (use file.path = file.dirname
instead).
Parameter | Type | Description |
---|---|---|
stem | string | Stem. |
void
Nothing.
node_modules/vfile/lib/index.d.ts:183
fail(
reason
,options
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
options ? | null | Options |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:244
fail(
reason
,parent
,origin
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
parent | undefined | null | Node | NodeLike | |
origin ? | null | string |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:305
fail(
reason
,place
,origin
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
place | undefined | null | Position | Point | |
origin ? | null | string |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:366
fail(
reason
,origin
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
origin ? | null | string |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:427
fail(
cause
,parent
,origin
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
parent | undefined | null | Node | NodeLike | |
origin ? | null | string |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:488
fail(
cause
,place
,origin
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
place | undefined | null | Position | Point | |
origin ? | null | string |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:549
fail(
cause
,origin
?):never
Create a fatal message for reason
associated with the file.
The fatal
field of the message is set to true
(error; file not usable)
and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
origin ? | null | string |
never
Never.
Message.
node_modules/vfile/lib/index.d.ts:610
info(
reason
,options
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
options ? | null | Options |
Message.
node_modules/vfile/lib/index.d.ts:669
info(
reason
,parent
,origin
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
parent | undefined | null | Node | NodeLike | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:728
info(
reason
,place
,origin
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
place | undefined | null | Position | Point | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:787
info(
reason
,origin
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:846
info(
cause
,parent
,origin
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
parent | undefined | null | Node | NodeLike | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:905
info(
cause
,place
,origin
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
place | undefined | null | Position | Point | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:964
info(
cause
,origin
?):VFileMessage
Create an info message for reason
associated with the file.
The fatal
field of the message is set to undefined
(info; change
likely not needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1023
message(
reason
,options
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
options ? | null | Options |
Message.
node_modules/vfile/lib/index.d.ts:1082
message(
reason
,parent
,origin
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
parent | undefined | null | Node | NodeLike | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1141
message(
reason
,place
,origin
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
place | undefined | null | Position | Point | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1200
message(
reason
,origin
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
reason | string | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1259
message(
cause
,parent
,origin
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
parent | undefined | null | Node | NodeLike | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1318
message(
cause
,place
,origin
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
place | undefined | null | Position | Point | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1377
message(
cause
,origin
?):VFileMessage
Create a message for reason
associated with the file.
The fatal
field of the message is set to false
(warning; change may be
needed) and the file
field is set to the current file path.
The message is added to the messages
field on file
.
🪦 Note: also has obsolete signatures.
Parameter | Type | Description |
---|---|---|
cause | Error | VFileMessage | |
origin ? | null | string |
Message.
node_modules/vfile/lib/index.d.ts:1436
toString(
encoding
?):string
Serialize the file.
Note: which encodings are supported depends on the engine. For info on Node.js, see: <https://nodejs.org/api/util.html#whatwg-supported-encodings\>.
Parameter | Type | Description |
---|---|---|
encoding ? | null | string | Character encoding to understand value as when it’s a Uint8Array (default: 'utf-8' ). |
string
Serialized file.
node_modules/vfile/lib/index.d.ts:1450