vite-plugin-kaitai
v1.1.1
Published
Vite plugin for importing Kaitai Struct files directly
Downloads
23
Readme
vite-plugin-kaitai
Allows you to directly import Kaitai Struct (.ksy
) files,
including auto-generating some (somewhat rudimentary) type definitions.
Installation
npm i -D vite-plugin-kaitai kaitai-struct
vite.config.js
/** @type {import("vite").UserConfig} */
export default {
plugins: [..., kaitai()],
}
tsconfig.json
{
compilerOptions: {
rootDirs: [
"./",
"./.svelte-kit/types", // add this too if you're using SvelteKit!
"./generated",
],
},
}
Usage
import FileFormat from "path/to/file-format.ksy"
const parsedFile = new FileFormat(fs.readFileSync(...))