Skip to content

Commit 7bc9040

Browse files
committed
Update locatefile documentation
1 parent f5b6351 commit 7bc9040

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

README.md

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,12 @@ tests](src/test/integration/index.ts).
7979
#### `WASMagicOptions`
8080

8181
```typescript
82-
type ModuleOptions = {
83-
locateFile?: (path: string, prefix: string) => string;
84-
};
85-
8682
type WASMagicOptions = {
8783
flags?: WASMagicFlags;
8884
loadDefaultMagicfile?: boolean;
8985
magicFiles?: Uint8Array[];
9086
stdio?: (stdioName: "stdout" | "stderr", text: string) => void;
91-
moduleOptions?: ModuleOptions;
87+
locateFile?: (path: string, prefix: string) => string;
9288
};
9389
```
9490

@@ -183,12 +179,7 @@ development of this module.
183179
**Default**: `(_stdioName: "stdout" | "stderr", _text: string) => {}` (No
184180
output)
185181

186-
##### `moduleOptions`
187-
188-
`moduleOptions` is an optional object that allows you to pass configuration
189-
options directly to the underlying Emscripten WASM module.
190-
191-
###### `moduleOptions.locateFile`
182+
###### `locateFile`
192183

193184
`locateFile` is a `function` that allows you to customize how the WASM module
194185
locates the `libmagic-wrapper.wasm` file. This is particularly useful when
@@ -207,13 +198,11 @@ Example using a custom path:
207198
import { WASMagic } from "wasmagic";
208199

209200
const magic = await WASMagic.create({
210-
moduleOptions: {
211-
locateFile: (path, prefix) => {
212-
if (path.endsWith(".wasm")) {
213-
return `/custom/path/to/${path}`;
214-
}
215-
return prefix + path;
216-
},
201+
locateFile: (path, prefix) => {
202+
if (path.endsWith(".wasm")) {
203+
return `/custom/path/to/${path}`;
204+
}
205+
return prefix + path;
217206
},
218207
});
219208
```

0 commit comments

Comments
 (0)