Created
July 16, 2025 07:06
-
-
Save NerOcrO/a6658d42fc28f677393646b192729dcc to your computer and use it in GitHub Desktop.
snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// parcourir un fichier csv via un champ d'upload | |
const formData = await request.formData() | |
const [diagnostiqueur] = formData.values() as FormDataIterator<File> | |
if (diagnostiqueur === undefined) { | |
return new Response("Bulk insert failed", { status: 200 }) | |
} | |
const data = (await diagnostiqueur.text()) | |
.split(/\r\n|\r|\n/) | |
.slice(1) | |
.filter((ligne): boolean => ligne !== "") | |
.map((ligne): Prisma.DiagnostiqueurCreateManyInput => { | |
const splitLine = ligne.split(";") | |
return { | |
nom: splitLine[0], | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment