mirror of
https://github.com/fabrice404/olympics-calendar.git
synced 2026-01-23 04:53:15 +00:00
add other languages
This commit is contained in:
11
src/io.ts
Normal file
11
src/io.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||
|
||||
export const saveFile = (path: string, content: string): void => {
|
||||
const folder = path.split("/").slice(0, -1).join("/");
|
||||
mkdirSync(folder, { recursive: true });
|
||||
writeFileSync(path, content);
|
||||
};
|
||||
|
||||
export const hasFile = (path: string) => existsSync(path);
|
||||
|
||||
export const readFile = (path: string) => readFileSync(path, "utf-8");
|
||||
Reference in New Issue
Block a user