frida-fs 4.0.2 → 5.0.0
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 +13 -7
- package/package.json +5 -2
package/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {Buffer} from 'buffer';
|
|
2
|
-
import
|
|
2
|
+
import process from 'process';
|
|
3
|
+
import {Readable} from 'readable-stream/lib/readable.js';
|
|
4
|
+
import {Writable} from 'readable-stream/lib/writable.js';
|
|
3
5
|
|
|
4
6
|
const {platform, pointerSize} = Process;
|
|
5
7
|
|
|
@@ -88,7 +90,7 @@ const SEEK_END = 2;
|
|
|
88
90
|
|
|
89
91
|
const EINTR = 4;
|
|
90
92
|
|
|
91
|
-
class ReadStream extends
|
|
93
|
+
class ReadStream extends Readable {
|
|
92
94
|
constructor(path) {
|
|
93
95
|
super({
|
|
94
96
|
highWaterMark: 4 * 1024 * 1024
|
|
@@ -100,8 +102,10 @@ class ReadStream extends stream.Readable {
|
|
|
100
102
|
const pathStr = Memory.allocUtf8String(path);
|
|
101
103
|
const fd = getApi().open(pathStr, constants.O_RDONLY, 0);
|
|
102
104
|
if (fd.value === -1) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
process.nextTick(() => {
|
|
106
|
+
this.emit('error', new Error(`Unable to open file (${getErrorString(fd.errno)})`));
|
|
107
|
+
this.push(null);
|
|
108
|
+
});
|
|
105
109
|
return;
|
|
106
110
|
}
|
|
107
111
|
|
|
@@ -141,7 +145,7 @@ class ReadStream extends stream.Readable {
|
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
|
|
144
|
-
class WriteStream extends
|
|
148
|
+
class WriteStream extends Writable {
|
|
145
149
|
constructor(path) {
|
|
146
150
|
super({
|
|
147
151
|
highWaterMark: 4 * 1024 * 1024
|
|
@@ -155,8 +159,10 @@ class WriteStream extends stream.Writable {
|
|
|
155
159
|
const mode = constants.S_IRUSR | constants.S_IWUSR | constants.S_IRGRP | constants.S_IROTH;
|
|
156
160
|
const fd = getApi().open(pathStr, flags, mode);
|
|
157
161
|
if (fd.value === -1) {
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
process.nextTick(() => {
|
|
163
|
+
this.emit('error', new Error(`Unable to open file (${getErrorString(fd.errno)})`));
|
|
164
|
+
this.push(null);
|
|
165
|
+
});
|
|
160
166
|
return;
|
|
161
167
|
}
|
|
162
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frida-fs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Create a stream from a filesystem resource",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,5 +15,8 @@
|
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/nowsecure/frida-fs/issues"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://github.com/nowsecure/frida-fs#readme"
|
|
18
|
+
"homepage": "https://github.com/nowsecure/frida-fs#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"readable-stream": "^4.0.0"
|
|
21
|
+
}
|
|
19
22
|
}
|