forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnode_file_utils.h
More file actions
39 lines (28 loc) · 1.13 KB
/
node_file_utils.h
File metadata and controls
39 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#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_