url.toString()


URL 对象上的 toString() 方法返回序列化的网址。 返回值等同于 url.hrefurl.toJSON() 的值。

由于需要符合标准,该方法不允许用户自定义网址的序列化过程。 为了获得更大的灵活性,可能会对 require('url').format() 方法感兴趣。

The toString() method on the URL object returns the serialized URL. The value returned is equivalent to that of url.href and url.toJSON().

Because of the need for standard compliance, this method does not allow users to customize the serialization process of the URL. For more flexibility, require('url').format() method might be of interest.