frida-fs 4.0.1 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +11 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {Buffer} from 'buffer';
|
|
2
|
+
import process from 'process';
|
|
1
3
|
import stream from 'stream';
|
|
2
4
|
|
|
3
5
|
const {platform, pointerSize} = Process;
|
|
@@ -99,8 +101,10 @@ class ReadStream extends stream.Readable {
|
|
|
99
101
|
const pathStr = Memory.allocUtf8String(path);
|
|
100
102
|
const fd = getApi().open(pathStr, constants.O_RDONLY, 0);
|
|
101
103
|
if (fd.value === -1) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
process.nextTick(() => {
|
|
105
|
+
this.emit('error', new Error(`Unable to open file (${getErrorString(fd.errno)})`));
|
|
106
|
+
this.push(null);
|
|
107
|
+
});
|
|
104
108
|
return;
|
|
105
109
|
}
|
|
106
110
|
|
|
@@ -127,6 +131,7 @@ class ReadStream extends stream.Readable {
|
|
|
127
131
|
.catch(error => {
|
|
128
132
|
this._readRequest = null;
|
|
129
133
|
this._closeInput();
|
|
134
|
+
this.emit('error', error);
|
|
130
135
|
this.push(null);
|
|
131
136
|
});
|
|
132
137
|
}
|
|
@@ -153,8 +158,10 @@ class WriteStream extends stream.Writable {
|
|
|
153
158
|
const mode = constants.S_IRUSR | constants.S_IWUSR | constants.S_IRGRP | constants.S_IROTH;
|
|
154
159
|
const fd = getApi().open(pathStr, flags, mode);
|
|
155
160
|
if (fd.value === -1) {
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
process.nextTick(() => {
|
|
162
|
+
this.emit('error', new Error(`Unable to open file (${getErrorString(fd.errno)})`));
|
|
163
|
+
this.push(null);
|
|
164
|
+
});
|
|
158
165
|
return;
|
|
159
166
|
}
|
|
160
167
|
|