Home / Function/ chunkToByteArray() — astro Function Reference

chunkToByteArray() — astro Function Reference

Architecture documentation for the chunkToByteArray() function in common.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  829cbefa_4c56_bedf_00ac_fa4b0752a1d7["chunkToByteArray()"]
  dc345517_d883_7bce_edfa_c6cabf28094d["common.ts"]
  829cbefa_4c56_bedf_00ac_fa4b0752a1d7 -->|defined in| dc345517_d883_7bce_edfa_c6cabf28094d
  fb23a8c0_fa0b_aec3_d37d_c4f2ea9dc8da["stringifyChunk()"]
  829cbefa_4c56_bedf_00ac_fa4b0752a1d7 -->|calls| fb23a8c0_fa0b_aec3_d37d_c4f2ea9dc8da
  style 829cbefa_4c56_bedf_00ac_fa4b0752a1d7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/render/common.ts lines 143–154

export function chunkToByteArray(
	result: SSRResult,
	chunk: Exclude<RenderDestinationChunk, Response>,
): Uint8Array {
	if (ArrayBuffer.isView(chunk)) {
		return chunk as Uint8Array;
	} else {
		// `stringifyChunk` might return a HTMLString, call `.toString()` to really ensure it's a string
		const stringified = stringifyChunk(result, chunk);
		return encoder.encode(stringified.toString());
	}
}

Domain

Subdomains

Frequently Asked Questions

What does chunkToByteArray() do?
chunkToByteArray() is a function in the astro codebase, defined in packages/astro/src/runtime/server/render/common.ts.
Where is chunkToByteArray() defined?
chunkToByteArray() is defined in packages/astro/src/runtime/server/render/common.ts at line 143.
What does chunkToByteArray() call?
chunkToByteArray() calls 1 function(s): stringifyChunk.

Analyze Your Own Codebase

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

Try Supermodel Free