Hello World!

This commit is contained in:
Sakura Knoll
2021-12-20 00:57:38 +09:00 Unverified
commit 61bf657f23
1744 changed files with 22024 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
import fs from 'fs'
import path from 'path'
const basePathname = path.join(process.cwd(), 'public/data')
export function resolvePathname(pathname: string) {
return path.join(basePathname, pathname)
}
export function readdirSync(pathname: string) {
const fileList = fs.readdirSync(resolvePathname(pathname))
return fileList
}
export function readFileSync(pathname: string) {
return fs.readFileSync(resolvePathname(pathname))
}
export function readJsonFileSync(pathname: string) {
const rawData = readFileSync(pathname).toString()
return JSON.parse(rawData)
}