* fix: remove usage of readFileAsync * fix: use same import style * fix: update tests Co-authored-by: Peter Bengtsson <mail@peterbe.com>
16 lines
393 B
JavaScript
16 lines
393 B
JavaScript
import fs from 'fs/promises'
|
|
|
|
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 fs.readFile(filepath, 'utf8')
|
|
|
|
fileContent = encodeBracketedParentheses(fileContent)
|
|
|
|
return fm(fileContent, { filepath })
|
|
}
|