FIX: Make biome happy
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
e0e566db76
commit
3d970acc34
@@ -54,12 +54,15 @@ export async function get_documentation_model(
|
|||||||
|
|
||||||
export async function downloadModel(bytes: Uint8Array, fileName: string) {
|
export async function downloadModel(bytes: Uint8Array, fileName: string) {
|
||||||
const sanitizedFileName = sanitizeFileName(fileName);
|
const sanitizedFileName = sanitizeFileName(fileName);
|
||||||
|
// Create a real ArrayBuffer and copy the data
|
||||||
|
const buffer = new ArrayBuffer(bytes.byteLength);
|
||||||
|
new Uint8Array(buffer).set(bytes);
|
||||||
const response = await fetch("/api/download", {
|
const response = await fetch("/api/download", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
},
|
},
|
||||||
body: bytes,
|
body: buffer,
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Network response was not ok");
|
throw new Error("Network response was not ok");
|
||||||
@@ -82,12 +85,16 @@ export async function downloadModel(bytes: Uint8Array, fileName: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function shareModel(bytes: Uint8Array): Promise<string> {
|
export async function shareModel(bytes: Uint8Array): Promise<string> {
|
||||||
|
// Create a real ArrayBuffer and copy the data
|
||||||
|
const buffer = new ArrayBuffer(bytes.byteLength);
|
||||||
|
new Uint8Array(buffer).set(bytes);
|
||||||
|
|
||||||
const response = await fetch("/api/share", {
|
const response = await fetch("/api/share", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/octet-stream",
|
"Content-Type": "application/octet-stream",
|
||||||
},
|
},
|
||||||
body: bytes,
|
body: buffer,
|
||||||
});
|
});
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Network response was not ok");
|
throw new Error("Network response was not ok");
|
||||||
|
|||||||
Reference in New Issue
Block a user