binary.js — astro Source File
Architecture documentation for binary.js, a javascript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 1ad8079f_0d76_2e2a_a705_e60d823d712d["binary.js"] ac8a42f6_5aa5_8f99_4bd8_1bb5c48f6021["node:fs"] 1ad8079f_0d76_2e2a_a705_e60d823d712d --> ac8a42f6_5aa5_8f99_4bd8_1bb5c48f6021 style 1ad8079f_0d76_2e2a_a705_e60d823d712d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import fs from 'node:fs';
export function GET() {
return new Response('ok')
}
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 });
}
function buffersEqual(buf1, buf2) {
if (buf1.byteLength != buf2.byteLength) return false;
const dv1 = new Uint8Array(buf1);
const dv2 = new Uint8Array(buf2);
for (let i = 0; i !== buf1.byteLength; i++) {
if (dv1[i] != dv2[i]) return false;
}
return true;
}
Domain
Subdomains
Functions
Dependencies
- node:fs
Source
Frequently Asked Questions
What does binary.js do?
binary.js is a source file in the astro codebase, written in javascript. It belongs to the TestingInfrastructure domain, FixtureManager subdomain.
What functions are defined in binary.js?
binary.js defines 3 function(s): GET, POST, buffersEqual.
What does binary.js depend on?
binary.js imports 1 module(s): node:fs.
Where is binary.js in the architecture?
binary.js is located at packages/astro/test/fixtures/ssr-api-route/src/pages/binary.js (domain: TestingInfrastructure, subdomain: FixtureManager, directory: packages/astro/test/fixtures/ssr-api-route/src/pages).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free