improvement

This commit is contained in:
Metazla
2024-04-06 16:16:16 +02:00
parent 06bdd8402a
commit 5045120fbb
21 changed files with 152 additions and 251 deletions
@@ -52,4 +52,4 @@ declare function computeCIDs({ filePath, algorithms }: {
algorithms: CID_ALGORITHM_NAMES[];
}): Promise<string[]>;
export { type ComputeInterface as C, type MultiHashData as M, type SimpleHash as S, CID_ALGORITHM_NAMES as a, CID_ALGORITHM_CODES as b, CID_ALGORITHM as c, computeCIDs as d };
export { CID_ALGORITHM_NAMES as C, type MultiHashData as M, type SimpleHash as S, type ComputeInterface as a, CID_ALGORITHM_CODES as b, CID_ALGORITHM as c, computeCIDs as d };
@@ -52,4 +52,4 @@ declare function computeCIDs({ filePath, algorithms }: {
algorithms: CID_ALGORITHM_NAMES[];
}): Promise<string[]>;
export { type ComputeInterface as C, type MultiHashData as M, type SimpleHash as S, CID_ALGORITHM_NAMES as a, CID_ALGORITHM_CODES as b, CID_ALGORITHM as c, computeCIDs as d };
export { CID_ALGORITHM_NAMES as C, type MultiHashData as M, type SimpleHash as S, type ComputeInterface as a, CID_ALGORITHM_CODES as b, CID_ALGORITHM as c, computeCIDs as d };
+7 -7
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+14 -12
View File
@@ -1,16 +1,9 @@
import { C as ComputeInterface, a as CID_ALGORITHM_NAMES, M as MultiHashData } from './ShaComputeWorker-DxWHpwX4.cjs';
export { c as CID_ALGORITHM, b as CID_ALGORITHM_CODES, S as SimpleHash } from './ShaComputeWorker-DxWHpwX4.cjs';
import { C as CID_ALGORITHM_NAMES, a as ComputeInterface, M as MultiHashData } from './ShaComputeWorker-BzBitaFi.cjs';
export { c as CID_ALGORITHM, b as CID_ALGORITHM_CODES, S as SimpleHash } from './ShaComputeWorker-BzBitaFi.cjs';
import * as PQueue from 'p-queue';
import PQueue__default from 'p-queue';
import * as p_queue_dist_priority_queue_js from 'p-queue/dist/priority-queue.js';
declare class HashComputer implements ComputeInterface {
private targetHash;
private fileIDComputer;
constructor(targetHash: CID_ALGORITHM_NAMES[], workerPath?: string);
computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;
}
interface IndexLine extends Partial<Record<CID_ALGORITHM_NAMES, string>> {
path: string;
size: string;
@@ -42,17 +35,19 @@ declare class HashIndexManager {
loadIndex(hash: CID_ALGORITHM_NAMES): Promise<IndexLine[]>;
private loadIndexFromCache;
private readCsv;
private saveCacheToFile;
saveCacheToFile(): Promise<void>;
getCidForFileAsync(filePath: string): Promise<IndexLine>;
getCidForFile(filePath: string, fileSize: number, mtime: string): IndexLine;
addFileCid(filePath: string, fileSize: number, mtime: string, hashs: Partial<Record<CID_ALGORITHM_NAMES, string>>): void;
}
declare class ComputeHashIndexCache implements ComputeInterface {
private targetHash;
hashIndexManager: HashIndexManager;
hashComputer: HashComputer;
private hashIndexManager;
private hashComputer;
constructor(indexFilePath: string, targetHash?: CID_ALGORITHM_NAMES[], workerPath?: string);
computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;
getHashIndexManager(): Promise<HashIndexManager>;
}
declare function existsAsync(filePath: string): Promise<boolean>;
@@ -69,6 +64,13 @@ declare class FileIDComputer {
computeCIDs(filePath: string, algorithms: CID_ALGORITHM_NAMES[]): Promise<string[]>;
}
declare class HashComputer implements ComputeInterface {
private targetHash;
private fileIDComputer;
constructor(targetHash: CID_ALGORITHM_NAMES[], workerPath?: string);
computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;
}
interface Properties {
TARGET_HASHES: string;
INDEX_FILE_PATH: string;
+14 -12
View File
@@ -1,16 +1,9 @@
import { C as ComputeInterface, a as CID_ALGORITHM_NAMES, M as MultiHashData } from './ShaComputeWorker-DxWHpwX4.js';
export { c as CID_ALGORITHM, b as CID_ALGORITHM_CODES, S as SimpleHash } from './ShaComputeWorker-DxWHpwX4.js';
import { C as CID_ALGORITHM_NAMES, a as ComputeInterface, M as MultiHashData } from './ShaComputeWorker-BzBitaFi.js';
export { c as CID_ALGORITHM, b as CID_ALGORITHM_CODES, S as SimpleHash } from './ShaComputeWorker-BzBitaFi.js';
import * as PQueue from 'p-queue';
import PQueue__default from 'p-queue';
import * as p_queue_dist_priority_queue_js from 'p-queue/dist/priority-queue.js';
declare class HashComputer implements ComputeInterface {
private targetHash;
private fileIDComputer;
constructor(targetHash: CID_ALGORITHM_NAMES[], workerPath?: string);
computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;
}
interface IndexLine extends Partial<Record<CID_ALGORITHM_NAMES, string>> {
path: string;
size: string;
@@ -42,17 +35,19 @@ declare class HashIndexManager {
loadIndex(hash: CID_ALGORITHM_NAMES): Promise<IndexLine[]>;
private loadIndexFromCache;
private readCsv;
private saveCacheToFile;
saveCacheToFile(): Promise<void>;
getCidForFileAsync(filePath: string): Promise<IndexLine>;
getCidForFile(filePath: string, fileSize: number, mtime: string): IndexLine;
addFileCid(filePath: string, fileSize: number, mtime: string, hashs: Partial<Record<CID_ALGORITHM_NAMES, string>>): void;
}
declare class ComputeHashIndexCache implements ComputeInterface {
private targetHash;
hashIndexManager: HashIndexManager;
hashComputer: HashComputer;
private hashIndexManager;
private hashComputer;
constructor(indexFilePath: string, targetHash?: CID_ALGORITHM_NAMES[], workerPath?: string);
computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;
getHashIndexManager(): Promise<HashIndexManager>;
}
declare function existsAsync(filePath: string): Promise<boolean>;
@@ -69,6 +64,13 @@ declare class FileIDComputer {
computeCIDs(filePath: string, algorithms: CID_ALGORITHM_NAMES[]): Promise<string[]>;
}
declare class HashComputer implements ComputeInterface {
private targetHash;
private fileIDComputer;
constructor(targetHash: CID_ALGORITHM_NAMES[], workerPath?: string);
computeMissingHash(filePath: string, metadata: MultiHashData): Promise<void>;
}
interface Properties {
TARGET_HASHES: string;
INDEX_FILE_PATH: string;
+4 -4
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
export { S as SimpleHash, d as default } from './ShaComputeWorker-DxWHpwX4.cjs';
export { S as SimpleHash, d as default } from './ShaComputeWorker-BzBitaFi.cjs';
+1 -1
View File
@@ -1 +1 @@
export { S as SimpleHash, d as default } from './ShaComputeWorker-DxWHpwX4.js';
export { S as SimpleHash, d as default } from './ShaComputeWorker-BzBitaFi.js';