mirror of
https://github.com/diced/zipline.git
synced 2026-01-22 17:29:15 -08:00
16 lines
369 B
TypeScript
Executable File
16 lines
369 B
TypeScript
Executable File
import { readFile } from 'fs/promises';
|
|
import { extname } from 'path';
|
|
|
|
export type CodeMeta = {
|
|
ext: string;
|
|
name: string;
|
|
mime: string;
|
|
};
|
|
|
|
export async function isCode(file: string) {
|
|
const codeMeta: CodeMeta[] = JSON.parse(await readFile('./code.json', 'utf8'));
|
|
const ext = extname(file).slice(1);
|
|
|
|
return codeMeta.some((meta) => meta.ext === ext);
|
|
}
|