Simple tinyhttp + formidable example.
tinyhttp new file-uploadnode index.js
Then send a file (using curl or any other HTTP client):
curl -F "file=@index.js" localhost:3000/api/uploadOutput should be something like this:
{
"fields": {},
"files": {
"file": {
"size": 705,
"path": "/tmp/upload_09830274c55da0f3ffdc1d45ebe2bbe9",
"name": "index.js",
"type": "application/octet-stream",
"mtime": "2020-09-08T19:36:52.735Z"
}
}
}