Skip to content

Webpack loader for kaitai-struct .ksy definitions

License

Notifications You must be signed in to change notification settings

kaitai-io/kaitai_struct_loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kaitai Struct loader for webpack

npm

This webpack loader adds support for Kaitai Struct .ksy definitions.

Installation

yarn add --dev kaitai-struct-loader

Usage

file.js

import KaitaiStream from 'kaitai-struct/KaitaiStream';
import DoomWAD from './game/doom_wad.ksy';

const stream = new KaitaiStream(arrayBuffer);
const data = new DoomWAD(stream);

The specification of the Doom .wad format can be found in the format gallery.

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.ksy$/,
        use: [{
          loader: 'kaitai-struct-loader',
          // options: { debug: true },
        }],
      },
    ]
  }
}

Options

Name Type Default Description
debug {boolean} false Compile .ksy files in --debug mode
(see #332 for more info)