Skip to content
API

Host the cleaner yourself.

Two routes, inspect and clean, in one file with no dependencies. Deploy it as a Cloudflare Worker or run it on Node. Files go to your server and stop there; FileSanity never sees them.

  1. npx wrangler deployfrom the unzipped folder: a Worker on your own Cloudflare account
  2. API_TOKEN=change-me node node.mjs 8787or a Node process, anywhere
  3. curl -H "Authorization: Bearer change-me" --data-binary @photo.jpg -H "X-Filename: photo.jpg" https://your-host/inspectthe report as JSON
  4. curl -H "Authorization: Bearer change-me" -F file=@offer.docx "https://your-host/clean?keep=core" -o offer-clean.docxthe clean file, with a policy

Bytes in, bytes out.

POST /inspect takes the file as the request body, or as a multipart part named file, and returns the same report the page shows: every segment, every field, what would be removed and what kept.

POST /clean takes the same input and returns the clean file, with X-FileSanity-Removed and X-FileSanity-Kept counts and, where the page would show a note, X-FileSanity-Note. ?keep=exif,xmp applies a policy.

The name comes from the part, an X-Filename header or ?name=; the bytes decide the format. Set API_TOKEN and every call needs a bearer token; without one the API is open, so keep it on a private network. Errors are 401, 415 for a format it does not read, 422 for a file it could not rewrite.

Your server holds each file only for the length of the request. Nothing is written, logged or forwarded by the handler; what your platform logs is your platform's business.

Nothing to host?

The command line tool is the same parsers in one file for a shell.