1 |
|
2 |
|
3 |
|
4 |
|
5 | var inherits = require('util').inherits;
|
6 | var EventEmitter = require('events').EventEmitter;
|
7 |
|
8 | function SFTPWrapper(stream) {
|
9 | var self = this;
|
10 |
|
11 | EventEmitter.call(this);
|
12 |
|
13 | this._stream = stream;
|
14 |
|
15 | stream.on('error', function(err) {
|
16 | self.emit('error', err);
|
17 | }).on('end', function() {
|
18 | self.emit('end');
|
19 | }).on('close', function() {
|
20 | self.emit('close');
|
21 | }).on('continue', function() {
|
22 | self.emit('continue');
|
23 | });
|
24 | }
|
25 | inherits(SFTPWrapper, EventEmitter);
|
26 |
|
27 |
|
28 | SFTPWrapper.prototype.end = function() {
|
29 | return this._stream.end();
|
30 | };
|
31 |
|
32 | SFTPWrapper.prototype.createReadStream = function(path, options) {
|
33 | return this._stream.createReadStream(path, options);
|
34 | };
|
35 | SFTPWrapper.prototype.createWriteStream = function(path, options) {
|
36 | return this._stream.createWriteStream(path, options);
|
37 | };
|
38 | SFTPWrapper.prototype.open = function(path, flags, attrs, cb) {
|
39 | return this._stream.open(path, flags, attrs, cb);
|
40 | };
|
41 | SFTPWrapper.prototype.close = function(handle, cb) {
|
42 | return this._stream.close(handle, cb);
|
43 | };
|
44 | SFTPWrapper.prototype.read = function(handle, buf, off, len, position, cb) {
|
45 | return this._stream.readData(handle, buf, off, len, position, cb);
|
46 | };
|
47 | SFTPWrapper.prototype.write = function(handle, buf, off, len, position, cb) {
|
48 | return this._stream.writeData(handle, buf, off, len, position, cb);
|
49 | };
|
50 | SFTPWrapper.prototype.fastGet = function(remotePath, localPath, opts, cb) {
|
51 | return this._stream.fastGet(remotePath, localPath, opts, cb);
|
52 | };
|
53 | SFTPWrapper.prototype.fastPut = function(localPath, remotePath, opts, cb) {
|
54 | return this._stream.fastPut(localPath, remotePath, opts, cb);
|
55 | };
|
56 | SFTPWrapper.prototype.readFile = function(path, options, callback_) {
|
57 | return this._stream.readFile(path, options, callback_);
|
58 | };
|
59 | SFTPWrapper.prototype.writeFile = function(path, data, options, callback_) {
|
60 | return this._stream.writeFile(path, data, options, callback_);
|
61 | };
|
62 | SFTPWrapper.prototype.appendFile = function(path, data, options, callback_) {
|
63 | return this._stream.appendFile(path, data, options, callback_);
|
64 | };
|
65 | SFTPWrapper.prototype.exists = function(path, cb) {
|
66 | return this._stream.exists(path, cb);
|
67 | };
|
68 | SFTPWrapper.prototype.unlink = function(filename, cb) {
|
69 | return this._stream.unlink(filename, cb);
|
70 | };
|
71 | SFTPWrapper.prototype.rename = function(oldPath, newPath, cb) {
|
72 | return this._stream.rename(oldPath, newPath, cb);
|
73 | };
|
74 | SFTPWrapper.prototype.mkdir = function(path, attrs, cb) {
|
75 | return this._stream.mkdir(path, attrs, cb);
|
76 | };
|
77 | SFTPWrapper.prototype.rmdir = function(path, cb) {
|
78 | return this._stream.rmdir(path, cb);
|
79 | };
|
80 | SFTPWrapper.prototype.readdir = function(where, opts, cb) {
|
81 | return this._stream.readdir(where, opts, cb);
|
82 | };
|
83 | SFTPWrapper.prototype.fstat = function(handle, cb) {
|
84 | return this._stream.fstat(handle, cb);
|
85 | };
|
86 | SFTPWrapper.prototype.stat = function(path, cb) {
|
87 | return this._stream.stat(path, cb);
|
88 | };
|
89 | SFTPWrapper.prototype.lstat = function(path, cb) {
|
90 | return this._stream.lstat(path, cb);
|
91 | };
|
92 | SFTPWrapper.prototype.opendir = function(path, cb) {
|
93 | return this._stream.opendir(path, cb);
|
94 | };
|
95 | SFTPWrapper.prototype.setstat = function(path, attrs, cb) {
|
96 | return this._stream.setstat(path, attrs, cb);
|
97 | };
|
98 | SFTPWrapper.prototype.fsetstat = function(handle, attrs, cb) {
|
99 | return this._stream.fsetstat(handle, attrs, cb);
|
100 | };
|
101 | SFTPWrapper.prototype.futimes = function(handle, atime, mtime, cb) {
|
102 | return this._stream.futimes(handle, atime, mtime, cb);
|
103 | };
|
104 | SFTPWrapper.prototype.utimes = function(path, atime, mtime, cb) {
|
105 | return this._stream.utimes(path, atime, mtime, cb);
|
106 | };
|
107 | SFTPWrapper.prototype.fchown = function(handle, uid, gid, cb) {
|
108 | return this._stream.fchown(handle, uid, gid, cb);
|
109 | };
|
110 | SFTPWrapper.prototype.chown = function(path, uid, gid, cb) {
|
111 | return this._stream.chown(path, uid, gid, cb);
|
112 | };
|
113 | SFTPWrapper.prototype.fchmod = function(handle, mode, cb) {
|
114 | return this._stream.fchmod(handle, mode, cb);
|
115 | };
|
116 | SFTPWrapper.prototype.chmod = function(path, mode, cb) {
|
117 | return this._stream.chmod(path, mode, cb);
|
118 | };
|
119 | SFTPWrapper.prototype.readlink = function(path, cb) {
|
120 | return this._stream.readlink(path, cb);
|
121 | };
|
122 | SFTPWrapper.prototype.symlink = function(targetPath, linkPath, cb) {
|
123 | return this._stream.symlink(targetPath, linkPath, cb);
|
124 | };
|
125 | SFTPWrapper.prototype.realpath = function(path, cb) {
|
126 | return this._stream.realpath(path, cb);
|
127 | };
|
128 |
|
129 | SFTPWrapper.prototype.ext_openssh_rename = function(oldPath, newPath, cb) {
|
130 | return this._stream.ext_openssh_rename(oldPath, newPath, cb);
|
131 | };
|
132 | SFTPWrapper.prototype.ext_openssh_statvfs = function(path, cb) {
|
133 | return this._stream.ext_openssh_statvfs(path, cb);
|
134 | };
|
135 | SFTPWrapper.prototype.ext_openssh_fstatvfs = function(handle, cb) {
|
136 | return this._stream.ext_openssh_fstatvfs(handle, cb);
|
137 | };
|
138 | SFTPWrapper.prototype.ext_openssh_hardlink = function(oldPath, newPath, cb) {
|
139 | return this._stream.ext_openssh_hardlink(oldPath, newPath, cb);
|
140 | };
|
141 | SFTPWrapper.prototype.ext_openssh_fsync = function(handle, cb) {
|
142 | return this._stream.ext_openssh_fsync(handle, cb);
|
143 | };
|
144 |
|
145 | module.exports = SFTPWrapper;
|