Optional value: null | CompatibleFile value.
New instance.
Base of path (default: process.cwd() or '/' in browsers).
Place to store custom info (default: {}).
It’s OK to store custom data directly on the file but moving it to
data is recommended.
List of file paths the file moved between.
The first is the original path and the last is the current path.
Source map.
This type is equivalent to the RawSourceMap type from the source-map
module.
List of messages associated with the file.
Custom, non-string, compiled, representation.
This is used by unified to store non-string results. One example is when turning markdown into React nodes.
Whether a file was saved to disk.
This is used by vfile reporters.
Raw value.
Get the basename (including extname) (example: 'index.min.js').
Basename.
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).
Nothing.
Get the parent path (example: '~').
Dirname.
Set the parent path (example: '~').
Cannot be set if there’s no path yet.
Nothing.
Get the extname (including dot) (example: '.js').
Extname.
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.
Nothing.
Get the full path (example: '~/index.min.js').
Path.
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.
Nothing.
Get the stem (basename w/o extname) (example: 'index.min').
Stem.
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).
Nothing.
Optional options: null | OptionsOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional options: null | OptionsOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional options: null | OptionsOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringOptional origin: null | stringSerialize 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.
Optional encoding: null | stringCharacter encoding to understand value as when it’s a Uint8Array
(default: 'utf-8').
Serialized file.
Create a new virtual file.
optionsis treated as:stringorUint8Array—{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
dirnameorextnamewithout setting eitherhistory,path,basename, orstemtoo.