Convert stream to immutable byte array and url