This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dayjs from "dayjs" | |
import { supportedLanguages } from "../config" | |
import fs from "fs" | |
import path from "path" | |
const cwd = process.cwd() | |
import util from "util" | |
import glob from "glob" | |
const stat = util.promisify(fs.stat) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs'; | |
import * as path from 'path'; | |
const base64regex: RegExp = /^data:([A-Za-z-+\/]+);base64,(.+)$/; | |
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; | |
const defaultFileOptions = { filePath: './uploads', types: ['jpg', 'jpeg', 'png'], randomizeFileNameLength: 10 }; | |
const typesArrayToRegex = async (types: string[]) => { | |
const typesToString = await Promise.all( | |
types.map((type, index) => (index === types.length - 1 ? `${type}` : `${type}|`)), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dayjs from "dayjs" | |
import { supportedLanguages } from "../config" | |
const fs = require("fs") | |
const path = require("path") | |
const cwd = process.cwd() | |
const matter = require("gray-matter") | |
const util = require("util") | |
const glob = require("glob") |