UNPKG

@flymeth/datapackjs

Version:

A great library to create your own minecraft datapack with javascript!

15 lines (13 loc) 377 B
import fs from 'fs' import { parse } from 'path' type mkTypes = "file" | "folder" function mk(type: mkTypes, path: string, datas?: string) { if(type=== "file") { const { dir } = parse(path) mk("folder", dir) fs.writeFileSync(path, datas || "") }else fs.mkdirSync(path, { recursive: true }) } export default mk