/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/node_file_utils.h
39 строк
1 KB
Joyee Cheung
src: consolidate C++ ReadFileSync/WriteFileSync utilities
07 фев 2026, 05:38
07 фев 2026, 05:38
3ab9dd8
Код
Авторство
О чём код?
#ifndef SRC_NODE_FILE_UTILS_H_ #define SRC_NODE_FILE_UTILS_H_ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include <cstdio> #include <functional> #include <string> #include <vector> #include "uv.h" #include "v8.h" namespace node { // Synchronously writes to a file. If the file exists, it is replaced // (truncated). int WriteFileSync(const char* path, uv_buf_t buf); int WriteFileSync(const char* path, uv_buf_t* bufs, size_t buf_count); int WriteFileSync(v8::Isolate* isolate, const char* path, v8::Local<v8::String> string); // Synchronously reads the entire contents of a file. int ReadFileSync(const char* path, std::string* result); int ReadFileSync(const char* path, std::vector<uint8_t>* result); // Legacy interface. TODO(joyeecheung): update the callers to pass path first, // output parameters second. int ReadFileSync(std::string* result, const char* path); // This is currently only used by embedder APIs that take a FILE*. std::vector<char> ReadFileSync(FILE* fp); } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #endif // SRC_NODE_FILE_UTILS_H_