2018-08-16 10:49:37 +00:00
|
|
|
import * as Path from 'path';
|
2018-10-02 01:32:32 +00:00
|
|
|
const fileUrl = require('file-url');
|
2018-08-16 10:49:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Resolve and encode the path information into a URL.
|
|
|
|
*
|
|
|
|
* @param pathSegments array of path segments to resolve
|
|
|
|
*/
|
|
|
|
export function encodePathAsUrl(...pathSegments: string[]): string {
|
|
|
|
const path = Path.resolve(...pathSegments);
|
|
|
|
return fileUrl(path);
|
|
|
|
}
|