util

util / FileConverter / 0.2.10

README.md

message from the author: If you noticed a particular file conversion is missing that you'd like us to support, please leave a comment below and I'll be happy to add that to our growing list!

Table of Contents

Introduction

This algorithm can convert a file to a bunch of other formats, allowing you to always have a file in the format you require!

here are the currently available conversions:

image(png, jpg, etc), html, csv, docx, odt, txt, md -> pdf
image(png, jpg, etc), pdf, html, txt -> img
html, md, txt -> docx, odt
txt, doc, docx, odt, md -> html

The algorithm doesn't detect the input file by extension, but rather by liberal user of unix file, a rather versatile file detection tool.

I/O

Input

{  
   "input":String,
   "output":String,
   "collection":"String
}
  • input - (required) - The input file to convert, can be either hosted on the data API (data://, dropbox://, or s3://), or as a public HTTP web resource.
  • output - (required) - The file name & format you want to convert to, the extension of the filename determines how the conversion is performed.
  • collection - (required) - the algorithmia data collection that you'd like to place your newly converted file into, can be data://, dropbox:// or s3://.

Output

"output":String
  • output - the complete path to your newly converted file.

Example

input

{  
   "input":"data://util/SampleCollection/sample.txt",
   "output":"sample.pdf",
   "collection":"data://.algo/perm"
}

output

"data://.algo/perm/sample.pdf"

Credits

most text conversions would be nearly impossible without the fantastic work done by the pandoc team!

For some special conversions like html to pdf, we used wkhtmltoX, another fantastic open source conversion application.

All image conversions were made possible by imagemagick and the wand python package.