import * as URI from 'vs/base/common/uri'; const uriString = 'https://example.com/path/to/resource.html?id=12345'; const uri = URI.parse(uriString); console.log(uri.scheme); // prints 'https' console.log(uri.authority); // prints 'example.com' console.log(uri.path); // prints '/path/to/resource.html' console.log(uri.query); // prints 'id=12345'
import * as URI from 'vs/base/common/uri'; const uri = URI.create({ scheme: 'https', authority: 'example.com', path: '/path/to/resource.html', query: 'id=12345', }); console.log(uri.toString()); // prints 'https://example.com/path/to/resource.html?id=12345'In both examples, we import the URI library from `vs/base/common/uri`, then use the `URI` object to parse or create a URI. We can access different parts of a URI by accessing its properties. The `toString()` method returns the string representation of the URI. Package library: Visual Studio Code Base