diff --git a/README.md b/README.md index 2fd6ddc..a05155f 100644 --- a/README.md +++ b/README.md @@ -637,3 +637,14 @@ const builder = Builder.new(urlSettings); - `generate_c2pa_archive` - Whether to generate C2PA archive format **Note:** Settings are passed as per-instance configuration. There are no global settings that affect all Readers and Builders. + + +### Build and use custom binary +**Build rust binary:** +``` +npm run build:rust +``` +**Use custom rust binary:** +```bash +export C2PA_LIBRARY_PATH=/index.node +``` diff --git a/js-src/binary.ts b/js-src/binary.ts index c914559..5591533 100644 --- a/js-src/binary.ts +++ b/js-src/binary.ts @@ -23,7 +23,8 @@ let neon: any = null; // Get the binary module (loads synchronously on first access) export function getNeonBinary() { if (neon === null) { - neon = require("./index.node"); + const C2PA_LIBRARY_PATH = process.env.C2PA_LIBRARY_PATH; + neon = require(C2PA_LIBRARY_PATH ?? "./index.node"); } return neon; }