npm.io
0.3.0 • Published 9 years ago

@augmt/file-metadata-microservice

Licence
MIT
Version
0.3.0
Deps
3
Vulns
4
Weekly
0

File Metadata Microservice

Get the size of a file in bytes.

How it Works

This microservice uses koa-body to parse binary data and Koa and koa-router to serve requests.

How to Use

app.js exports a Koa app. Koa apps have an app.listen() method that is identical to Node's http.Server.listen().

Import app.js and call app.listen() to start up the microservice.

API Resources

POST /

Returns an object containing the data's size in bytes.

REQUEST

Sample: https://file-metadata-microservice.example.com/

Content-Type: multipart/form-data

Request:

------WebKitFormBoundary7fkjhx85BAWpokZH
Content-Disposition: form-data; name="file"; filename="blob"
Content-Type: text/plain


------WebKitFormBoundary7fkjhx85BAWpokZH--
RESPONSE

Status: 200 - application/json

Response:

{
  "filesize": 1149
}