Skip to content

Latest commit

 

History

History
64 lines (52 loc) · 1.51 KB

File metadata and controls

64 lines (52 loc) · 1.51 KB

"quickjs:bytecode" (namespace)

declare module "quickjs:bytecode" {
  export function fromFile(
    path: string,
    options?: {
      byteSwap?: boolean;
      sourceType?: "module" | "script";
      encodedFileName?: string;
    },
  ): ArrayBuffer;
  export function fromValue(
    value: any,
    options?: {
      byteSwap?: boolean;
    },
  ): ArrayBuffer;
  export function toValue(bytecode: ArrayBuffer): any;
}

"quickjs:bytecode".fromFile (exported function)

Convert the module or script in the specified file into bytecode.

When converted back to a value, it will be a function.

export function fromFile(
  path: string,
  options?: {
    byteSwap?: boolean;
    sourceType?: "module" | "script";
    encodedFileName?: string;
  },
): ArrayBuffer;

"quickjs:bytecode".fromValue (exported function)

Convert the provided value into bytecode. Doesn't work with all values.

export function fromValue(
  value: any,
  options?: {
    byteSwap?: boolean;
  },
): ArrayBuffer;

"quickjs:bytecode".toValue (exported function)

Convert the provided bytecode into a value.

export function toValue(bytecode: ArrayBuffer): any;