Home / Function/ POST() — astro Function Reference

POST() — astro Function Reference

Architecture documentation for the POST() function in binary.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  93cdd5a1_ae4a_1982_f432_372934d5d1ab["POST()"]
  fd7746e8_2130_961b_5a50_e0498e638a5c["binary.js"]
  93cdd5a1_ae4a_1982_f432_372934d5d1ab -->|defined in| fd7746e8_2130_961b_5a50_e0498e638a5c
  16567aed_432a_ba84_24de_f90cb5f7884b["buffersEqual()"]
  93cdd5a1_ae4a_1982_f432_372934d5d1ab -->|calls| 16567aed_432a_ba84_24de_f90cb5f7884b
  style 93cdd5a1_ae4a_1982_f432_372934d5d1ab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js lines 7–20

export async function POST({ request }) {
	const data = await request.formData();
	const file = data.get('file');

	if (file) {
		const buffer = await file.arrayBuffer();
		const realBuffer = await fs.promises.readFile(new URL('../images/penguin.jpg', import.meta.url));

		if(buffersEqual(buffer, realBuffer)) {
			return new Response('ok', { status: 200 });
		}	
	}
	return new Response(null, { status: 400 });
}

Subdomains

Frequently Asked Questions

What does POST() do?
POST() is a function in the astro codebase, defined in packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js.
Where is POST() defined?
POST() is defined in packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js at line 7.
What does POST() call?
POST() calls 1 function(s): buffersEqual.

Analyze Your Own Codebase

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

Try Supermodel Free