Skip to content

file-reader

readFileContent(file) ⇒ Promise.<string>

Reads the content of a file and parses its Vitepress header.

Kind: global function
Returns: Promise.<string> - A promise that resolves with the parsed content of the file.
Throws:

  • Will throw an error if there's an issue reading the file or parsing its content.
ParamTypeDescription
fileDirectoryFileThe file object representing the file to be read.

Example

js
const file = {name: 'example', ext: '.md', folder: '/src/docs'};
const content = await readFileContent(file);
const file = {name: 'example', ext: '.md', folder: '/src/docs'};
const content = await readFileContent(file);

Released under the MIT License.