Skip to content

Commit f5b6351

Browse files
committed
Change locatefile typedef to use Emscripten output
- Flatten config object
1 parent 50770a5 commit f5b6351

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,14 @@ export enum WASMagicFlags {
6464
NO_CHECK_SIMH = 0x0800000,
6565
}
6666

67-
type ModuleOptions = {
68-
locateFile?: (path: string, prefix: string) => string,
69-
}
67+
export type LibmagicLocateFile = LibmagicModule["locateFile"];
7068

7169
export type WASMagicOptions = {
7270
flags?: WASMagicFlags;
7371
loadDefaultMagicfile?: boolean;
7472
magicFiles?: Uint8Array[];
7573
stdio?: StdioOverrideFunction;
76-
moduleOptions?: ModuleOptions;
74+
locateFile?: LibmagicLocateFile;
7775
};
7876

7977
type WASMagicOptionsComplete = {
@@ -94,7 +92,9 @@ export class WASMagic {
9492
static async create(
9593
options: WASMagicOptions = defaultWASMagicOptions,
9694
): Promise<WASMagic> {
97-
const Module = await libmagicFactory(options.moduleOptions);
95+
const Module = await libmagicFactory({
96+
locateFile: options.locateFile,
97+
});
9898
return new WASMagic(Module, options);
9999
}
100100

0 commit comments

Comments
 (0)