| 77 | } |
| 78 | |
| 79 | maajs::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 | |
| 91 | void maa_rt_write_file(std::string path, maajs::ArrayBufferType data) |
| 92 | { |