Home / Function/ xxhash() — astro Function Reference

xxhash() — astro Function Reference

Architecture documentation for the xxhash() function in content-layer.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  35df5732_0ce0_9b72_552a_6b58f4f43cc3["xxhash()"]
  4a6efe25_e6e4_25af_3955_aede0d8f5983["ContentLayer"]
  35df5732_0ce0_9b72_552a_6b58f4f43cc3 -->|defined in| 4a6efe25_e6e4_25af_3955_aede0d8f5983
  style 35df5732_0ce0_9b72_552a_6b58f4f43cc3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/content-layer.ts lines 102–116

	async #getGenerateDigest() {
		if (this.#generateDigest) {
			return this.#generateDigest;
		}
		// xxhash is a very fast non-cryptographic hash function that is used to generate a content digest
		// It uses wasm, so we need to load it asynchronously.
		const { h64ToString } = await xxhash();

		this.#generateDigest = (data: unknown) => {
			const dataString = typeof data === 'string' ? data : JSON.stringify(data);
			return h64ToString(dataString);
		};

		return this.#generateDigest;
	}

Subdomains

Frequently Asked Questions

What does xxhash() do?
xxhash() is a function in the astro codebase, defined in packages/astro/src/content/content-layer.ts.
Where is xxhash() defined?
xxhash() is defined in packages/astro/src/content/content-layer.ts at line 102.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free