expresso
  • Get Started
    • 👋Welcome!
    • ⚡Quick Start
  • Expresso Library
    • 📖Introduction
    • ⚛️expresso-core
      • Currency
      • Random String
      • Formatter
      • File
      • Phone
    • ⚓expresso-hooks
      • Multer
      • Token
      • OTP
    • 🚀expresso-provider
      • FCM
      • SMTP
      • Redis
      • Storage
    • 🔗expresso-query
      • TypeORM
      • Sequelize
Powered by GitBook
On this page
  • Create dir not exist
  • Read HTML File
  • Delete File
  1. Expresso Library
  2. expresso-core

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)
PreviousFormatterNextPhone

Last updated 1 year ago

⚛️