DEV Community

Bobo
Bobo

Posted on

csv-api: Turn CSV Processing into a REST API

csv-api: Turn CSV Processing into a REST API

csv-api is a lightweight REST API server that lets you clean, convert, and analyze CSV files over HTTP. Perfect for integrating CSV processing into your web applications or automation pipelines.

Installation

npm install -g csv-api
Enter fullscreen mode Exit fullscreen mode

Quick Start

# Start the server
csv-api --port 3000

# API is now available at http://localhost:3000
Enter fullscreen mode Exit fullscreen mode

API Endpoints

Upload & Clean CSV

curl -X POST http://localhost:3000/clean \
  -F "file=@data.csv" \
  -F "remove_empty=true" \
  -F "deduplicate=true"
Enter fullscreen mode Exit fullscreen mode

Convert Formats

curl -X POST http://localhost:3000/convert \
  -F "file=@data.csv" \
  -F "format=json"
Enter fullscreen mode Exit fullscreen mode

Analyze Data

curl http://localhost:3000/analyze?file=uploaded.csv
# Returns column stats, row count, data types
Enter fullscreen mode Exit fullscreen mode

Filter & Query

curl "http://localhost:3000/query?file=sales.csv&column=revenue&min=1000"
Enter fullscreen mode Exit fullscreen mode

Deploy Anywhere

# Railway
railway.json included for one-click deploy

# Docker coming soon
Enter fullscreen mode Exit fullscreen mode

Links

  • npm package coming soon

💻 GitHub: github.com/lb1192176991-lab/csv-processing-api-server

🌐 Visit us: https://www.tucaowall.vip/


Looking for a CLI version? Check out csv-toolkit for command-line CSV processing!

☁️ Get free DigitalOcean credit: https://m.do.co/c/fc5cb7b29a0d

Top comments (0)