works on node and browser