Closed
Description
With the legacy api, I could obtain the addon module using this code:
void Init(Local<Object> exports, Local<Object> module) {
NODE_SET_METHOD(module, "exports", CreateObject);
}
NODE_MODULE(NODE_GYP_MODULE_NAME, Init)
I need the module to obtain the addon filename (and folder) using this code:
std::string static GetModuleFilename(v8::Handle<v8::Object> module)
{
Isolate* isolate = Isolate::GetCurrent();
auto v8filename = module->Get(v8::String::NewFromUtf8(isolate, "filename"));
auto filename = NodeTypes::FromV8String(v8filename);
return filename;
}
How can I get the module and the filename at initialization time now?