Files
archy/apps/web5-dwn/node_modules/ipfs-unixfs-exporter/src/resolvers/index.ts
T
Dorian 0d073fa89e Add comprehensive installation and setup documentation
- Add GETTING_STARTED.md with quick start guide and development modes
- Add INSTALL.sh automated installation script
- Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md
- Add QUICK_REFERENCE.md for common commands
- Add SETUP_GUIDE.md with detailed setup instructions
- Update README.md with improved project overview
- Add did-wallet app dependencies and node_modules
2026-01-27 17:18:21 +00:00

31 lines
977 B
TypeScript

import * as dagCbor from '@ipld/dag-cbor'
import * as dagPb from '@ipld/dag-pb'
import errCode from 'err-code'
import * as raw from 'multiformats/codecs/raw'
import { identity } from 'multiformats/hashes/identity'
import dagCborResolver from './dag-cbor.js'
import identifyResolver from './identity.js'
import rawResolver from './raw.js'
import dagPbResolver from './unixfs-v1/index.js'
import type { Resolve, Resolver } from '../index.js'
const resolvers: Record<number, Resolver> = {
[dagPb.code]: dagPbResolver,
[raw.code]: rawResolver,
[dagCbor.code]: dagCborResolver,
[identity.code]: identifyResolver
}
const resolve: Resolve = async (cid, name, path, toResolve, depth, blockstore, options) => {
const resolver = resolvers[cid.code]
if (resolver == null) {
throw errCode(new Error(`No resolver for code ${cid.code}`), 'ERR_NO_RESOLVER')
}
return resolver(cid, name, path, toResolve, resolve, depth, blockstore, options)
}
export default resolve