2323#include " aliased_buffer-inl.h"
2424#include " memory_tracker-inl.h"
2525#include " node_buffer.h"
26+ #include " node_debug.h"
2627#include " node_errors.h"
2728#include " node_external_reference.h"
2829#include " node_file-inl.h"
@@ -60,8 +61,6 @@ using v8::BigInt;
6061using v8::Context;
6162using v8::EscapableHandleScope;
6263using v8::FastApiCallbackOptions;
63- using v8::FastOneByteString;
64- using v8::Function;
6564using v8::FunctionCallbackInfo;
6665using v8::FunctionTemplate;
6766using v8::HandleScope;
@@ -1051,9 +1050,9 @@ static void ExistsSync(const FunctionCallbackInfo<Value>& args) {
10511050static void InternalModuleStat (const FunctionCallbackInfo<Value>& args) {
10521051 Environment* env = Environment::GetCurrent (args);
10531052
1054- CHECK_GE (args.Length (), 2 );
1055- CHECK (args[1 ]->IsString ());
1056- BufferValue path (env->isolate (), args[1 ]);
1053+ CHECK_EQ (args.Length (), 1 );
1054+ CHECK (args[0 ]->IsString ());
1055+ BufferValue path (env->isolate (), args[0 ]);
10571056 CHECK_NOT_NULL (*path);
10581057 ToNamespacedPath (env, &path);
10591058
@@ -1069,9 +1068,8 @@ static void InternalModuleStat(const FunctionCallbackInfo<Value>& args) {
10691068}
10701069
10711070static int32_t FastInternalModuleStat (
1072- Local<Object> unused,
1073- Local<Object> recv,
1074- const FastOneByteString& input,
1071+ Local<Value> recv,
1072+ Local<Value> input_,
10751073 // NOLINTNEXTLINE(runtime/references) This is V8 api.
10761074 FastApiCallbackOptions& options) {
10771075 // This needs a HandleScope which needs an isolate.
@@ -1081,9 +1079,13 @@ static int32_t FastInternalModuleStat(
10811079 return -1 ;
10821080 }
10831081
1082+ TRACK_V8_FAST_API_CALL (" fs.internalModuleStat" );
10841083 HandleScope scope (isolate);
10851084
1086- auto path = std::filesystem::path (input.data , input.data + input.length );
1085+ CHECK (input_->IsString ());
1086+ Utf8Value input (isolate, input_.As <String>());
1087+
1088+ auto path = std::filesystem::path (input.ToStringView ());
10871089
10881090 switch (std::filesystem::status (path).type ()) {
10891091 case std::filesystem::file_type::directory:
0 commit comments