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.
Files changed (2) hide show
  1. package/index.js +11 -4
  2. 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
- this.emit('error', new Error(`Unable to open file (${getErrorString(fd.errno)})`));
103
- this.push(null);
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
- this.emit('error', new Error(`Unable to open file (${getErrorString(fd.errno)})`));
157
- this.push(null);
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-fs",
3
- "version": "4.0.1",
3
+ "version": "5.0.1",
4
4
  "description": "Create a stream from a filesystem resource",
5
5
  "main": "index.js",
6
6
  "type": "module",