Code Monkey home page Code Monkey logo

versed's Introduction

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.

Versed frontend

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 to learn more!

Getting started

Run the following commands to get up and running.

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.

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

# 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

versed's People

Contributors

sgbj avatar kmpm avatar awoehler avatar advance512 avatar bzorky avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.