Add API + tests for Swarm

`raise ValueError("%s does not exist or is not a directory" % output_dir)`