/
node_zipfile.hpp
48 lines (37 loc) · 1.05 KB
/
node_zipfile.hpp
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
40
41
42
43
44
45
46
47
48
#ifndef __NODE_ZIPFILE_H__
#define __NODE_ZIPFILE_H__
#include <v8.h>
#include <node.h>
#include <node_object_wrap.h>
#include <node_version.h>
// stl
#include <string>
#include <vector>
// libzip
#include <zlib.h>
#include <errno.h>
#include <zip.h>
//#include <zipint.h>
using namespace v8;
using namespace node;
class ZipFile: public node::ObjectWrap {
public:
static Persistent<FunctionTemplate> constructor;
static void Initialize(Handle<Object> target);
static Handle<Value> New(const Arguments &args);
static Handle<Value> get_prop(Local<String> property,
const AccessorInfo& info);
// Sync
static Handle<Value> readFileSync(const Arguments& args);
// Async
static Handle<Value> readFile(const Arguments& args);
static void EIO_ReadFile(uv_work_t* req);
static void EIO_AfterReadFile(uv_work_t* req);
ZipFile(std::string const& file_name);
private:
~ZipFile();
std::string const file_name_;
struct zip *archive_;
std::vector<std::string> names_;
};
#endif