Convert a node.js style callback API to use promises