Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/roe.dev. This is the code and content for my personal website, built in Nuxt. roe.dev
Something went wrong. Try again.
12345678910111213141516171819import { createHash } from 'crypto'import { join } from 'path'import { tmpdir } from 'os'import { writeFile } from 'fs'import { promisify } from 'util'
const promiseWriteFile = promisify(writeFile)
export async function writeTempFile(fileName: string, html: string) { const hashedFileName = createHash('md5').update(fileName).digest('hex') + '.html'
const filePath = join(tmpdir(), hashedFileName)
await promiseWriteFile(filePath, html)
return filePath}