Files
picobook/src/server/util/shrinko8.ts
T

20 lines
640 B
TypeScript
Raw Normal View History

2024-03-31 13:49:09 -07:00
import { execa } from "execa";
import path from "path";
import {fileURLToPath} from 'url';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const shrinko8DirPath = path.resolve(__dirname, "../shrinko8");
const shrinko8Path = path.resolve(shrinko8DirPath, "shrinko8.py");
2024-03-31 14:08:48 -07:00
const pico8DatPath = path.resolve(__dirname, "../../../data/pico8.dat");
2024-03-31 13:49:09 -07:00
export const shrinko8 = async (props: {
inputFile: string;
outputFile: string;
options?: string[];
}) => {
const {inputFile, outputFile, options = []} = props;
return await execa("python3", [shrinko8Path, inputFile, outputFile, "--pico8-dat", pico8DatPath, ...options])
}