url.toString()


URL对象上调用toString()方法将返回序列化的URL。返回值与url.hrefurl.toJSON()的相同。

由于需要符合标准,此方法不允许用户自定义URL的序列化过程。 如果需要更大灵活性,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.