@bsv/wallet-toolbox
Version:
BRC100 conforming wallet, wallet storage and wallet signer components
47 lines • 2.21 kB
TypeScript
import { ChaintracksAppendableFileApi, ChaintracksFsApi, ChaintracksReadableFileApi, ChaintracksWritableFileApi } from '../Api/ChaintracksFsApi';
import { promises as fs } from 'fs';
import Path from 'path';
export declare abstract class ChaintracksFsStatics {
static delete(path: string): Promise<void>;
static writeFile(path: string, data: Uint8Array): Promise<void>;
static readFile(path: string): Promise<Uint8Array>;
static openReadableFile(path: string): Promise<ChaintracksReadableFileApi>;
static openWritableFile(path: string): Promise<ChaintracksWritableFileApi>;
static openAppendableFile(path: string): Promise<ChaintracksAppendableFileApi>;
static ensureFoldersExist(path: string): Promise<void>;
static pathJoin(...parts: string[]): string;
}
/**
* This object is an implementation of the `ChaintracksFsApi` interface
* using the `fs` package which may not be available in all environments.
*/
export declare const ChaintracksFs: ChaintracksFsApi;
export declare class ChaintracksReadableFile implements ChaintracksReadableFileApi {
path: string;
parsedPath: Path.ParsedPath;
f: fs.FileHandle;
protected constructor(path: string, f: fs.FileHandle);
close(): Promise<void>;
getLength(): Promise<number>;
read(length?: number, offset?: number): Promise<Uint8Array>;
static openAsReadable(path: string): Promise<ChaintracksReadableFile>;
}
export declare class ChaintracksWritableFile implements ChaintracksWritableFileApi {
path: string;
parsedPath: Path.ParsedPath;
f: fs.FileHandle;
foldersEnsured: boolean;
private constructor();
static openAsWritable(path: string): Promise<ChaintracksWritableFile>;
close(): Promise<void>;
ensureFoldersExist(): Promise<void>;
append(data: Uint8Array): Promise<void>;
}
export declare class ChaintracksAppendableFile extends ChaintracksReadableFile implements ChaintracksAppendableFileApi {
foldersEnsured: boolean;
private constructor();
static openAsAppendable(path: string): Promise<ChaintracksAppendableFile>;
ensureFoldersExist(): Promise<void>;
append(data: Uint8Array): Promise<void>;
}
//# sourceMappingURL=ChaintracksFs.d.ts.map