UNPKG

1.4 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3import { Stats } from "fs-extra";
4export interface ReadAsarHeader {
5 readonly header: string;
6 readonly size: number;
7}
8export interface NodeIntegrity {
9 algorithm: "SHA256";
10 hash: string;
11 blockSize: number;
12 blocks: Array<string>;
13}
14export declare class Node {
15 files?: {
16 [key: string]: Node;
17 };
18 unpacked?: boolean;
19 size?: number;
20 offset?: string;
21 executable?: boolean;
22 link?: string;
23 integrity?: NodeIntegrity;
24}
25export declare class AsarFilesystem {
26 readonly src: string;
27 readonly header: Node;
28 readonly headerSize: number;
29 private offset;
30 constructor(src: string, header?: Node, headerSize?: number);
31 searchNodeFromDirectory(p: string, isCreate: boolean): Node | null;
32 getOrCreateNode(p: string): Node;
33 addFileNode(file: string, dirNode: Node, size: number, unpacked: boolean, stat: Stats, integrity?: NodeIntegrity): Node;
34 getNode(p: string): Node | null;
35 getFile(p: string, followLinks?: boolean): Node;
36 readJson(file: string): Promise<any>;
37 readFile(file: string): Promise<Buffer>;
38}
39export declare function readAsarHeader(archive: string): Promise<ReadAsarHeader>;
40export declare function readAsar(archive: string): Promise<AsarFilesystem>;
41export declare function readAsarJson(archive: string, file: string): Promise<any>;