Convert from Node-style callback APIs to promises APIs