improve doc

This commit is contained in:
Pierre
2026-05-25 23:48:03 +02:00
parent cd21b9de1e
commit ef21690b12
+5 -12
View File
@@ -25,7 +25,7 @@ To inspect the details of a CID, including its version, codec, multihash and mor
## Installation ## Installation
This package is part of the Meta Orbit monorepo and uses pnpm workspaces. This package is part of the MetaMesh monorepo and uses pnpm workspaces.
From the monorepo root: From the monorepo root:
```bash ```bash
@@ -41,21 +41,21 @@ When using as a dependency in other packages:
} }
``` ```
## Usage of ComputeHashIndexCache ## Usage of HashComputerIndexCache
To integrate Meta-Hash into your application, follow these steps: To integrate Meta-Hash into your application, follow these steps:
1. **Import the Library**: Import the necessary components from the library. 1. **Import the Library**: Import the necessary components from the library.
```typescript ```typescript
import { ComputeHashIndexCache, CID_ALGORITHM_NAMES } from "./folder-watch-hasher"; import { HashComputerIndexCache, CID_ALGORITHM_NAMES } from "./folder-watch-hasher";
``` ```
2. **Initialize the Watcher**: Create an instance of `ComputeHashIndexCache`, specifying the path to the folder you want to monitor and the hash algorithms you wish to use. 2. **Initialize the Watcher**: Create an instance of `HashComputerIndexCache`, specifying the path to the folder you want to monitor and the hash algorithms you wish to use.
```typescript ```typescript
//note that the csv file will be derived from the path provided into multiple files (one for each algorithm) //note that the csv file will be derived from the path provided into multiple files (one for each algorithm)
const computer = new ComputeHashIndexCache("path/to/your/indexfile/index.csv", [CID_ALGORITHM_NAMES.sha256, CID_ALGORITHM_NAMES.sha1]); const computer = new HashComputerIndexCache("path/to/your/indexfile/index.csv", [CID_ALGORITHM_NAMES.sha256, CID_ALGORITHM_NAMES.sha1]);
``` ```
3. **Compute Hashes**: Invoke the `computeMissingHash` method for each file you wish to hash. This method will automatically check the index for existing hashes and compute missing ones. 3. **Compute Hashes**: Invoke the `computeMissingHash` method for each file you wish to hash. This method will automatically check the index for existing hashes and compute missing ones.
@@ -160,13 +160,6 @@ pnpm test
Uses Vitest for unit tests. Uses Vitest for unit tests.
## Integration
Used by:
- **meta-mesh**: File content hashing for deduplication
- **meta-orbit**: Content addressing for distributed storage
- **meta-ui**: Browser-based file verification
## Performance ## Performance
- **Index Cache**: Avoids rehashing unchanged files (checks size + mtime) - **Index Cache**: Avoids rehashing unchanged files (checks size + mtime)