1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/lib/read-file-contents.js
2021-12-01 22:56:03 +00:00

15 lines
413 B
JavaScript

import readFileAsync from './readfile-async.js'
import encodeBracketedParentheses from './encode-bracketed-parentheses.js'
import fm from './frontmatter.js'
/**
* Read only the frontmatter from file
*/
export default async function fmfromf(filepath) {
let fileContent = await readFileAsync(filepath, 'utf8')
fileContent = encodeBracketedParentheses(fileContent)
return fm(fileContent, { filepath })
}