Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/titobrian97/Prueba-tecnica-ts-node---gestion-de-csv/llms.txt

Use this file to discover all available pages before exploring further.

CSV Manager parses uploaded files with the convert-csv-to-json library. The backend reads the raw file buffer as a UTF-8 string and passes it to csvStringToJson, producing an array of plain objects — one per data row. Getting the format right before uploading saves time and avoids confusing parse errors.

Requirements

RequirementDetail
DelimiterComma (,) — hardcoded via .fieldDelimiter(',')
Header rowRequired as the first row; column names become JSON object keys
MIME typeMust be text/csv — enforced before parsing begins
EncodingUTF-8 — the buffer is decoded with Buffer.from(file.buffer).toString('utf-8')
Value typesAll fields become string after parsing — no type coercion occurs

Example File

The repository ships with an example.csv that exercises all eight standard columns. Here are the first four rows:
id,nombre,apellido,edad,email,ciudad,pais,telefono
1,Carlos,Mendez,34,carlos.mendez@example.com,Cancun,Mexico,+52-998-123-4567
2,Ana,Rodriguez,28,ana.rodriguez@example.com,Bogota,Colombia,+57-301-234-5678
3,Juan,Perez,41,juan.perez@example.com,Madrid,España,+34-612-345-678
4,Laura,Gomez,22,laura.gomez@example.com,Lima,Peru,+51-987-456-321
The full file contains 20 rows spanning 14 countries and is a practical starting point for verifying that your local setup is working correctly.

CSV Row → JSON Object Mapping

Each data row is converted to an object whose keys are taken from the header row. Every value is a string:
1,Carlos,Mendez,34,carlos.mendez@example.com,Cancun,Mexico,+52-998-123-4567
becomes:
{
  "id": "1",
  "nombre": "Carlos",
  "apellido": "Mendez",
  "edad": "34",
  "email": "carlos.mendez@example.com",
  "ciudad": "Cancun",
  "pais": "Mexico",
  "telefono": "+52-998-123-4567"
}
Notice that edad ("34") and id ("1") are strings even though they look like numbers. If your application logic needs numeric comparisons, convert with Number() or parseInt() after fetching the data.

Custom Column Names

You are not limited to the eight columns shown above. Any header row is accepted — the column names you place in row 1 become the keys in every JSON object returned by the API. For example:
sku,product_name,price,stock
A001,Widget Pro,19.99,150
A002,Gadget Max,49.99,42
would return objects shaped as { "sku": "A001", "product_name": "Widget Pro", "price": "19.99", "stock": "150" }.
No — not without modifying the backend source code. The server calls .fieldDelimiter(',') unconditionally before parsing:
json = csvToJson.fieldDelimiter(",").csvStringToJson(rawCsv);
If your file uses semicolons (;), tabs (\t), or any other separator, the library will treat each entire row as a single field, producing malformed objects. Convert your file to comma-delimited format first (most spreadsheet apps export this as CSV UTF-8 (Comma delimited)), or change the fieldDelimiter argument in server.ts to match your file’s separator.
Before uploading your own data, test with the example.csv file found in the root of the repository. Running curl -X POST http://localhost:3000/api/files -F "file=@example.csv" from the project root is the fastest way to confirm that the backend is running and parsing correctly.

Build docs developers (and LLMs) love