# All files / src/emitter preamble.js

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    21x
    21x

    21x
    21x
    21x
    21x

    68x

     // @flow
    import { u32 } from 'wasm-types';
    import OutputStream from '../utils/output-stream';

    export const VERSION_1 = 0x1;
    export const MAGIC = 0x6d736100;
    export const MAGIC_INDEX = 0;
    export const VERSION_INDEX = 4;

    export default function write(version: number) {
      return new OutputStream()
        .push(u32, MAGIC, '\\0asm')
        .push(u32, version, `version ${version}`);
    }