Based upon the node commonjs example:
const { getOpenCv } = require("./opencv.js");
async function main() {
const { cv } = await getOpenCv();
console.log("OpenCV.js is ready!");
console.log(cv.getBuildInformation());
const inputImage = cv.imread("Lenna.png");
console.log("imread, done");
}
main();
Output:
(build info, as expected)
(a very long block of obfuscated code)
abort(ReferenceError: document is not defined). Build with -s ASSERTIONS=1 for more info.
(Use node --trace-uncaught ... to show where the exception was thrown)
Node.js v22.18.0