improve doc
This commit is contained in:
@@ -25,7 +25,7 @@ To inspect the details of a CID, including its version, codec, multihash and mor
|
||||
|
||||
## 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:
|
||||
```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:
|
||||
|
||||
1. **Import the Library**: Import the necessary components from the library.
|
||||
|
||||
```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
|
||||
//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.
|
||||
@@ -160,13 +160,6 @@ pnpm test
|
||||
|
||||
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
|
||||
|
||||
- **Index Cache**: Avoids rehashing unchanged files (checks size + mtime)
|
||||
|
||||
Reference in New Issue
Block a user