23
23
#include " aliased_buffer-inl.h"
24
24
#include " memory_tracker-inl.h"
25
25
#include " node_buffer.h"
26
+ #include " node_debug.h"
26
27
#include " node_errors.h"
27
28
#include " node_external_reference.h"
28
29
#include " node_file-inl.h"
@@ -60,8 +61,6 @@ using v8::BigInt;
60
61
using v8::Context;
61
62
using v8::EscapableHandleScope;
62
63
using v8::FastApiCallbackOptions;
63
- using v8::FastOneByteString;
64
- using v8::Function;
65
64
using v8::FunctionCallbackInfo;
66
65
using v8::FunctionTemplate;
67
66
using v8::HandleScope;
@@ -1051,9 +1050,9 @@ static void ExistsSync(const FunctionCallbackInfo<Value>& args) {
1051
1050
static void InternalModuleStat (const FunctionCallbackInfo<Value>& args) {
1052
1051
Environment* env = Environment::GetCurrent (args);
1053
1052
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 ]);
1057
1056
CHECK_NOT_NULL (*path);
1058
1057
ToNamespacedPath (env, &path);
1059
1058
@@ -1069,9 +1068,8 @@ static void InternalModuleStat(const FunctionCallbackInfo<Value>& args) {
1069
1068
}
1070
1069
1071
1070
static int32_t FastInternalModuleStat (
1072
- Local<Object> unused,
1073
- Local<Object> recv,
1074
- const FastOneByteString& input,
1071
+ Local<Value> recv,
1072
+ Local<Value> input_,
1075
1073
// NOLINTNEXTLINE(runtime/references) This is V8 api.
1076
1074
FastApiCallbackOptions& options) {
1077
1075
// This needs a HandleScope which needs an isolate.
@@ -1081,9 +1079,13 @@ static int32_t FastInternalModuleStat(
1081
1079
return -1 ;
1082
1080
}
1083
1081
1082
+ TRACK_V8_FAST_API_CALL (" fs.internalModuleStat" );
1084
1083
HandleScope scope (isolate);
1085
1084
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 ());
1087
1089
1088
1090
switch (std::filesystem::status (path).type ()) {
1089
1091
case std::filesystem::file_type::directory:
0 commit comments