https://github.com/sgbj/versed
A file conversion microservice written in Node
https://github.com/sgbj/versed
Last synced: 2 months ago
JSON representation
A file conversion microservice written in Node
- Host: GitHub
- URL: https://github.com/sgbj/versed
- Owner: sgbj
- License: mit
- Created: 2017-08-31T00:25:28.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-21T12:00:19.000Z (about 2 years ago)
- Last Synced: 2025-04-20T23:32:39.634Z (3 months ago)
- Language: Python
- Homepage: http://aka.sb/Versed
- Size: 3.36 MB
- Stars: 35
- Watchers: 3
- Forks: 22
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Versed
File conversion can be a pain. Especially when you're trying to automate it. That's why I created Versed, a microservice specifically for that purpose.Versed exposes a web API for converting files, and also comes with a simple web frontend for manual file conversion.

It's currently powered by LibreOffice and FFmpeg, which means it supports the same file formats that those tools support, but you can easily add more tools to its arsenal.
Read the [blog post](http://aka.sb/Versed) to learn more!
## Getting started
Run the following commands to get up and running.
```shell
git clone https://github.com/sgbj/versed.git
cd versed
docker build -t versed .
docker run -d -p 3000:3000 versed# this app uses https://github.com/debug-js/debug
# and if you want to see more logging use the DEBUG environment variable
docker run -it --rm -e DEBUG=versed* -p 3000:3000 versed
```Open a browser window and go to http://localhost:3000/.
## OpenAPI
You can access the OpenAPI (aka Swagger) 2.0 spec by accessing http://localhost:3000/openapi-spec.yaml or by opening the file in the public/ folder of the repo.
You can generate a client for this microservice by using https://editor.swagger.io/.
An example Python client (and an example usage script) is included in the clients/ folder of the repo.## Calling it from Node
One way to consume the convert endpoint in Node.js code is by using the [request package](https://www.npmjs.com/package/request).
```js
const fs = require('fs');
const request = require('request');let req = request.post('http://localhost:3000/convert');
let form = req.form();
form.append('file', fs.createReadStream('video.mp4'));
form.append('format', 'gif');
req.pipe(fs.createWriteStream('image.gif'));
```## Calling it using curl
```shell
# this will convert `testdata/file-sample_100kB.docx` to pdf and save it using the filename given in the resonse header.
curl -F format=pdf -F "file=@testdata/file-sample_100kB.docx" -OJ http://localhost:3000/convert```