Skip to content

node-api: allow retrieval of add-on file name

Unlike JS-only modules, native add-ons are always associated with a dynamic shared object from which they are loaded. Being able to retrieve its absolute path is important to native-only add-ons, i.e. add-ons that are not themselves being loaded from a JS-only module located in the same package as the native add-on itself.

Currently, the file name is obtained at environment construction time from the JS module.filename. Nevertheless, the presence of module is not required, because the file name could also be passed in via a private property added onto exports from the process.dlopen binding.

Fixes: https://github.com/nodejs/node-addon-api/issues/449

Merge request reports

Loading