Split off read-only library into a separate class

Also not using js-uri because it fails on ".." in a uri,
might use in some capacity later though