File

library file to simplify using filesystem

Using commonjs

const { createDirNotExist } = require('expresso-core')

Using ES6

import { createDirNotExist } from 'expresso-core'

Create dir not exist

import { createDirNotExist } from 'expresso-core'

const dir = `${process.cwd()}/public/temp`

createDirNotExist(dir)

Read HTML File

import { readHTMLFile } from 'expresso-core'

const filePath = path.resolve(`${process.cwd()}/public/output/test.html`)

const content = await readHTMLFile(filePath)

console.log(content)

// output:
// file buffer

Delete File

import { deleteFile } from 'expresso-core'

const filePath = path.resolve(`${process.cwd()}/public/output/test.txt`)

deleteFile(filePath)

Last updated