Loading json file from module

Hi, is there a way to load a file from node_modules using fs? my module has a sample json file within, and uses fs.readFile(path) to load it, but cannot locate - is there a trick to this?


Replace the path with “require.resolve(“akamai-nginx/sample.papi.json”)” and that will return what you want.



thanks! that worked. thought i had tried that :slight_smile: