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?
Thanks.
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?
Thanks.
Replace the path with “require.resolve(“akamai-nginx/sample.papi.json”)” and that will return what you want.
Thanks!
Francisco
thanks! that worked. thought i had tried that