Defined in: node_modules/vfile/lib/index.d.ts:1
new VFile(
value?
):VFile
Defined in: node_modules/vfile/lib/index.d.ts:24
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 |
VFile
New instance.
cwd:
string
Defined in: node_modules/vfile/lib/index.d.ts:30
Base of path
(default: process.cwd()
or '/'
in browsers).
data:
Data
Defined in: node_modules/vfile/lib/index.d.ts:39
Place to store custom info (default: {}
).
It’s OK to store custom data directly on the file but moving it to
data
is recommended.
history:
string
[]
Defined in: node_modules/vfile/lib/index.d.ts:47
List of file paths the file moved between.
The first is the original path and the last is the current path.
map:
undefined
|null
|Map
Defined in: node_modules/vfile/lib/index.d.ts:68
Source map.
This type is equivalent to the RawSourceMap
type from the source-map
module.
messages:
VFileMessage
[]
Defined in: node_modules/vfile/lib/index.d.ts:53
List of messages associated with the file.
result:
unknown
Defined in: node_modules/vfile/lib/index.d.ts:77
Custom, non-string, compiled, representation.
This is used by unified to store non-string results. One example is when turning markdown into React nodes.
stored:
boolean
Defined in: node_modules/vfile/lib/index.d.ts:85
Whether a file was saved to disk.
This is used by vfile reporters.
value:
Value
Defined in: node_modules/vfile/lib/index.d.ts:59
Raw value.
get basename():
undefined
|string
Defined in: node_modules/vfile/lib/index.d.ts:105
Get the basename (including extname) (example: 'index.min.js'
).
undefined
| string
Basename.
set basename(
basename
):void
Defined in: node_modules/vfile/lib/index.d.ts:98
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.
get dirname():
undefined
|string
Defined in: node_modules/vfile/lib/index.d.ts:143
Get the parent path (example: '~'
).
undefined
| string
Dirname.
set dirname(
dirname
):void
Defined in: node_modules/vfile/lib/index.d.ts:136
Set the parent path (example: '~'
).
Cannot be set if there’s no path
yet.
Parameter | Type | Description |
---|---|---|
dirname | undefined | string |
void
Nothing.
get extname():
undefined
|string
Defined in: node_modules/vfile/lib/index.d.ts:163
Get the extname (including dot) (example: '.js'
).
undefined
| string
Extname.
set extname(
extname
):void
Defined in: node_modules/vfile/lib/index.d.ts:156
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 |
void
Nothing.
get path():
string
Defined in: node_modules/vfile/lib/index.d.ts:125
Get the full path (example: '~/index.min.js'
).
string
Path.
set path(
path
):void
Defined in: node_modules/vfile/lib/index.d.ts:118
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 |
void
Nothing.
get stem():
undefined
|string
Defined in: node_modules/vfile/lib/index.d.ts:183
Get the stem (basename w/o extname) (example: 'index.min'
).
undefined
| string
Stem.
set stem(
stem
):void
Defined in: node_modules/vfile/lib/index.d.ts:176
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.
fail(
reason
,options?
):never
Defined in: node_modules/vfile/lib/index.d.ts:244
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
Message.
fail(
reason
,parent
,origin?
):never
Defined in: node_modules/vfile/lib/index.d.ts:305
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 |
origin? | null | string |
never
Message.
fail(
reason
,place
,origin?
):never
Defined in: node_modules/vfile/lib/index.d.ts:366
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 |
origin? | null | string |
never
Message.
fail(
reason
,origin?
):never
Defined in: node_modules/vfile/lib/index.d.ts:427
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
Message.
fail(
cause
,parent
,origin?
):never
Defined in: node_modules/vfile/lib/index.d.ts:488
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 |
origin? | null | string |
never
Message.
fail(
cause
,place
,origin?
):never
Defined in: node_modules/vfile/lib/index.d.ts:549
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 |
origin? | null | string |
never
Message.
fail(
cause
,origin?
):never
Defined in: node_modules/vfile/lib/index.d.ts:610
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
Message.
info(
reason
,options?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:669
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 |
info(
reason
,parent
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:728
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 |
origin? | null | string |
info(
reason
,place
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:787
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 |
origin? | null | string |
info(
reason
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:846
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 |
info(
cause
,parent
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:905
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 |
origin? | null | string |
info(
cause
,place
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:964
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 |
origin? | null | string |
info(
cause
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1023
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(
reason
,options?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1082
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(
reason
,parent
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1141
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 |
origin? | null | string |
message(
reason
,place
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1200
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 |
origin? | null | string |
message(
reason
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1259
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(
cause
,parent
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1318
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 |
origin? | null | string |
message(
cause
,place
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1377
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 |
origin? | null | string |
message(
cause
,origin?
):VFileMessage
Defined in: node_modules/vfile/lib/index.d.ts:1436
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 |
toString(
encoding?
):string
Defined in: node_modules/vfile/lib/index.d.ts:1450
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 |
string
Serialized file.