move migration binary functionality into a npm module