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;
@@ -1050,9 +1049,9 @@ static void ExistsSync(const FunctionCallbackInfo<Value>& args) {
10501049static void InternalModuleStat (const FunctionCallbackInfo<Value>& args) {
10511050 Environment* env = Environment::GetCurrent (args);
10521051
1053- CHECK_GE (args.Length (), 2 );
1054- CHECK (args[1 ]->IsString ());
1055- BufferValue path (env->isolate (), args[1 ]);
1052+ CHECK_EQ (args.Length (), 1 );
1053+ CHECK (args[0 ]->IsString ());
1054+ BufferValue path (env->isolate (), args[0 ]);
10561055 CHECK_NOT_NULL (*path);
10571056 ToNamespacedPath (env, &path);
10581057
@@ -1068,9 +1067,8 @@ static void InternalModuleStat(const FunctionCallbackInfo<Value>& args) {
10681067}
10691068
10701069static int32_t FastInternalModuleStat (
1071- Local<Object> unused,
1072- Local<Object> recv,
1073- const FastOneByteString& input,
1070+ Local<Value> recv,
1071+ Local<Value> input_,
10741072 // NOLINTNEXTLINE(runtime/references) This is V8 api.
10751073 FastApiCallbackOptions& options) {
10761074 // This needs a HandleScope which needs an isolate.
@@ -1080,9 +1078,13 @@ static int32_t FastInternalModuleStat(
10801078 return -1 ;
10811079 }
10821080
1081+ TRACK_V8_FAST_API_CALL (" fs.internalModuleStat" );
10831082 HandleScope scope (isolate);
10841083
1085- auto path = std::filesystem::path (input.data , input.data + input.length );
1084+ CHECK (input_->IsString ());
1085+ Utf8Value input (isolate, input_.As <String>());
1086+
1087+ auto path = std::filesystem::path (input.ToStringView ());
10861088
10871089 switch (std::filesystem::status (path).type ()) {
10881090 case std::filesystem::file_type::directory:
0 commit comments