MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / maa_rt_read_file

Function maa_rt_read_file

source/binding/NodeJS/src/apis/loader.cpp:79–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79maajs::ArrayBufferType maa_rt_read_file(maajs::EnvType env, std::string path)
80{
81 std::ifstream fin(path, std::ios_base::in | std::ios_base::binary);
82 std::stringstream buf;
83 buf << fin.rdbuf();
84 std::string content = buf.str();
85
86 auto result = maajs::ArrayBufferType::New(env, content.size());
87 std::memcpy(result.Data(), content.c_str(), content.size());
88 return result;
89}
90
91void maa_rt_write_file(std::string path, maajs::ArrayBufferType data)
92{

Callers

nothing calls this directly

Calls 3

DataMethod · 0.80
strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected