frida-fs 6.0.0 → 7.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/dist/index.d.ts CHANGED
@@ -1,8 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- /// <reference types="node" resolution-mode="require"/>
3
- /// <reference types="frida-gum" />
4
- /// <reference types="node" resolution-mode="require"/>
5
- /// <reference types="node" resolution-mode="require"/>
6
1
  import { Buffer } from "buffer";
7
2
  import stream from "stream";
8
3
  declare const constants: {
@@ -69,14 +64,14 @@ declare class Stats {
69
64
  type AsyncCallback<T> = (error: Error | null, result?: T) => void;
70
65
  export declare function createReadStream(path: string): ReadStream;
71
66
  export declare function createWriteStream(path: string): WriteStream;
72
- export declare const readdir: (args_0: string, args_1: AsyncCallback<string[]>) => void;
73
- export declare const readFile: (args_0: string, args_1: ReadFileOptions | undefined, args_2: AsyncCallback<string | Buffer>) => void;
74
- export declare const writeFile: (args_0: string, args_1: string | NodeJS.ArrayBufferView, args_2: WriteFileOptions | undefined, args_3: AsyncCallback<void>) => void;
75
- export declare const readlink: (args_0: string, args_1: AsyncCallback<string>) => void;
76
- export declare const rmdir: (args_0: string, args_1: AsyncCallback<void>) => void;
77
- export declare const unlink: (args_0: string, args_1: AsyncCallback<void>) => void;
78
- export declare const stat: (args_0: string, args_1: AsyncCallback<Stats>) => void;
79
- export declare const lstat: (args_0: string, args_1: AsyncCallback<Stats>) => void;
67
+ export declare const readdir: (path: string, args_1: AsyncCallback<string[]>) => void;
68
+ export declare const readFile: (path: string, options: ReadFileOptions | undefined, args_2: AsyncCallback<string | Buffer<ArrayBufferLike>>) => void;
69
+ export declare const writeFile: (path: string, data: string | NodeJS.ArrayBufferView<ArrayBufferLike>, options: WriteFileOptions | undefined, args_3: AsyncCallback<void>) => void;
70
+ export declare const readlink: (path: string, args_1: AsyncCallback<string>) => void;
71
+ export declare const rmdir: (path: string, args_1: AsyncCallback<void>) => void;
72
+ export declare const unlink: (path: string, args_1: AsyncCallback<void>) => void;
73
+ export declare const stat: (path: string, args_1: AsyncCallback<Stats>) => void;
74
+ export declare const lstat: (path: string, args_1: AsyncCallback<Stats>) => void;
80
75
  export { constants, readdirSync, list, readFileSync, writeFileSync, readlinkSync, rmdirSync, unlinkSync, statSync, lstatSync, Stats, };
81
76
  declare const _default: {
82
77
  constants: {
@@ -84,22 +79,22 @@ declare const _default: {
84
79
  };
85
80
  createReadStream: typeof createReadStream;
86
81
  createWriteStream: typeof createWriteStream;
87
- readdir: (args_0: string, args_1: AsyncCallback<string[]>) => void;
82
+ readdir: (path: string, args_1: AsyncCallback<string[]>) => void;
88
83
  readdirSync: typeof readdirSync;
89
84
  list: typeof list;
90
- readFile: (args_0: string, args_1: ReadFileOptions | undefined, args_2: AsyncCallback<string | Buffer>) => void;
91
- readFileSync: (path: string, options?: ReadFileOptions | undefined) => string | Buffer;
92
- writeFile: (args_0: string, args_1: string | NodeJS.ArrayBufferView, args_2: WriteFileOptions | undefined, args_3: AsyncCallback<void>) => void;
85
+ readFile: (path: string, options: ReadFileOptions | undefined, args_2: AsyncCallback<string | Buffer<ArrayBufferLike>>) => void;
86
+ readFileSync: (path: string, options?: ReadFileOptions) => string | Buffer;
87
+ writeFile: (path: string, data: string | NodeJS.ArrayBufferView<ArrayBufferLike>, options: WriteFileOptions | undefined, args_3: AsyncCallback<void>) => void;
93
88
  writeFileSync: typeof writeFileSync;
94
- readlink: (args_0: string, args_1: AsyncCallback<string>) => void;
89
+ readlink: (path: string, args_1: AsyncCallback<string>) => void;
95
90
  readlinkSync: (path: string) => string;
96
- rmdir: (args_0: string, args_1: AsyncCallback<void>) => void;
91
+ rmdir: (path: string, args_1: AsyncCallback<void>) => void;
97
92
  rmdirSync: (path: string) => void;
98
- unlink: (args_0: string, args_1: AsyncCallback<void>) => void;
93
+ unlink: (path: string, args_1: AsyncCallback<void>) => void;
99
94
  unlinkSync: (path: string) => void;
100
- stat: (args_0: string, args_1: AsyncCallback<Stats>) => void;
95
+ stat: (path: string, args_1: AsyncCallback<Stats>) => void;
101
96
  statSync: (path: string) => Stats;
102
- lstat: (args_0: string, args_1: AsyncCallback<Stats>) => void;
97
+ lstat: (path: string, args_1: AsyncCallback<Stats>) => void;
103
98
  lstatSync: (path: string) => Stats;
104
99
  Stats: typeof Stats;
105
100
  };
package/dist/index.js CHANGED
@@ -815,8 +815,10 @@ function statsReadField(name, path) {
815
815
  return undefined;
816
816
  }
817
817
  const [offset, type] = field;
818
- const read = (typeof type === "string") ? NativePointer.prototype["read" + type] : type;
819
- const value = read.call(this.buffer.add(offset), path);
818
+ const address = this.buffer.add(offset);
819
+ const value = (typeof type === "string")
820
+ ? NativePointer.prototype["read" + type].call(address)
821
+ : type.call(address, path);
820
822
  if (value instanceof Int64 || value instanceof UInt64)
821
823
  return value.valueOf();
822
824
  return value;
@@ -964,7 +966,7 @@ function makeApi(spec) {
964
966
  return api;
965
967
  }, {});
966
968
  }
967
- const kernel32 = isWindows ? Process.getModuleByName("kernel32.dll") : null;
969
+ let kernel32 = null;
968
970
  const nativeOpts = (isWindows && pointerSize === 4) ? { abi: "stdcall" } : {};
969
971
  function addApiPlaceholder(api, entry) {
970
972
  const [name] = entry;
@@ -972,6 +974,8 @@ function addApiPlaceholder(api, entry) {
972
974
  configurable: true,
973
975
  get() {
974
976
  const [, Ctor, retType, argTypes, wrapper] = entry;
977
+ if (isWindows && kernel32 === null)
978
+ kernel32 = Process.getModuleByName("kernel32.dll");
975
979
  let impl = null;
976
980
  const address = isWindows
977
981
  ? kernel32.findExportByName(name)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-fs",
3
- "version": "6.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "Create a stream from a filesystem resource",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,6 +25,6 @@
25
25
  "devDependencies": {
26
26
  "@types/frida-gum": "^19.0.0",
27
27
  "@types/node": "^18.15.3",
28
- "typescript": "^5.1.3"
28
+ "typescript": "^5.8.3"
29
29
  }
30
30
  }