Unify node and browser api