nitro-patcher 0.1.0 → 0.2.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/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
 
5
5
  运行环境:Node.js 22 或更高版本。
6
6
 
7
+ 完整的使用说明:<https://github.com/Xzonn/nitro-patcher/wiki>。
8
+
7
9
  ## 安装与 CLI
8
10
 
9
11
  ```sh
package/dist/browser.d.ts CHANGED
@@ -1,3 +1,19 @@
1
+ export interface PatchMetadata {
2
+ id?: string;
3
+ author?: string;
4
+ name?: string;
5
+ homepage?: string;
6
+ version?: string;
7
+ isBeta?: boolean;
8
+ }
9
+ export interface PatchReadme {
10
+ format: "markdown" | "plaintext";
11
+ content: string;
12
+ }
13
+ export interface PatchInfo {
14
+ metadata: PatchMetadata | null;
15
+ readme: PatchReadme | null;
16
+ }
1
17
  export interface BrowserPatchOptions {
2
18
  maxOutputSize?: number;
3
19
  maxWindowSize?: number;
@@ -6,7 +22,7 @@ export interface BrowserPatchOptions {
6
22
  }
7
23
  export interface BrowserPatchResult {
8
24
  buffer: Uint8Array<ArrayBuffer>;
9
- returnValue: 'SUCCESS' | 'MD5_MISMATCH';
25
+ returnValue: "SUCCESS" | "MD5_MISMATCH";
10
26
  inputMd5: string;
11
27
  outputMd5: string;
12
28
  }
@@ -26,8 +42,20 @@ export interface RomInfo {
26
42
  export declare const inspectRom: (bytes: Uint8Array) => RomInfo;
27
43
  /** Synchronous CPU work; call in a Web Worker for responsive browser UIs. */
28
44
  export declare const patchBuffer: (original: Uint8Array, archive: Uint8Array, options?: BrowserPatchOptions) => BrowserPatchResult;
45
+ /** Read and validate metadata.json from a patch package entirely in memory. */
46
+ export declare const readPatchMetadata: (archive: Uint8Array, options?: BrowserPatchOptions) => PatchMetadata | null;
47
+ /** Read a root README.md or README.txt from a patch package entirely in memory. */
48
+ export declare const readPatchReadme: (archive: Uint8Array, options?: BrowserPatchOptions) => PatchReadme | null;
49
+ /** Read metadata and README content while parsing the patch package only once. */
50
+ export declare const readPatchInfo: (archive: Uint8Array, options?: BrowserPatchOptions) => PatchInfo;
51
+ /** Extract one file from a ZIP archive entirely in memory. */
52
+ export declare const extractZipEntry: (archive: Uint8Array, entryName: string, options?: BrowserPatchOptions) => Uint8Array<ArrayBuffer>;
29
53
  export declare const PatchHelper: Readonly<{
54
+ extractZipEntry: (archive: Uint8Array, entryName: string, options?: BrowserPatchOptions) => Uint8Array<ArrayBuffer>;
30
55
  patchBuffer: (original: Uint8Array, archive: Uint8Array, options?: BrowserPatchOptions) => BrowserPatchResult;
56
+ readPatchInfo: (archive: Uint8Array, options?: BrowserPatchOptions) => PatchInfo;
57
+ readPatchMetadata: (archive: Uint8Array, options?: BrowserPatchOptions) => PatchMetadata | null;
58
+ readPatchReadme: (archive: Uint8Array, options?: BrowserPatchOptions) => PatchReadme | null;
31
59
  }>;
32
60
  export declare const NitroHelper: Readonly<{
33
61
  inspectRom: (bytes: Uint8Array) => RomInfo;