@azure-tools/uri
Version:
Common URI handling code.
81 lines • 2.93 kB
TypeScript
/**
* Simplify the given uri by resolving relative paths.
*
* @param uri
* @returns fully qualified url with protocol. Defaults to null:// if not provided
*/
export declare function simplifyUri(uri: string): string;
export declare function isUri(uri: string): boolean;
/**
* Create a 'file:///' URI from given absolute path.
* Examples:
* - "C:\swagger\storage.yaml" -> "file:///C:/swagger/storage.yaml"
* - "/input/swagger.yaml" -> "file:///input/swagger.yaml"
*/
export declare function createFileOrFolderUri(absolutePath: string): string;
export declare function ensureIfFileUri(uri: string): string;
export declare function ensureIsFolderUri(uri: string): string;
export declare function createFileUri(absolutePath: string): string;
export declare function createFolderUri(absolutePath: string): string;
export declare function getFilename(uri: string): string;
export declare function getFilenameWithoutExtension(uri: string): string;
export declare function toRawDataUrl(uri: string): string;
/**
* The singularity of all resolving.
* With URI as our one data type of truth, this method maps an absolute or relative path or URI to a URI using given base URI.
* @param baseUri Absolute base URI
* @param pathOrUri Relative/absolute path/URI
* @returns Absolute URI
*/
export declare function resolveUri(baseUri: string, pathOrUri: string): string;
export declare function parentFolderUri(uri: string): string | null;
export declare function makeRelativeUri(baseUri: string, absoluteUri: string): string;
/**
* @deprecated use isUri instead.
*/
export declare const IsUri: typeof isUri;
/**
* @deprecated use createFileOrFolderUri instead.
*/
export declare const CreateFileOrFolderUri: typeof createFileOrFolderUri;
/**
* @deprecated use ensureIfFileUri instead.
*/
export declare const EnsureIfFileUri: typeof ensureIfFileUri;
/**
* @deprecated use ensureIsFolderUri instead.
*/
export declare const EnsureIsFolderUri: typeof ensureIsFolderUri;
/**
* @deprecated use createFileUri instead.
*/
export declare const CreateFileUri: typeof createFileUri;
/**
* @deprecated use createFolderUri instead.
*/
export declare const CreateFolderUri: typeof createFolderUri;
/**
* @deprecated use toRawDataUrl instead.
*/
export declare const ToRawDataUrl: typeof toRawDataUrl;
/**
* @deprecated use getFilename instead.
*/
export declare const GetFilename: typeof getFilename;
/**
* @deprecated use getFilenameWithoutExtension instead.
*/
export declare const GetFilenameWithoutExtension: typeof getFilenameWithoutExtension;
/**
* @deprecated use resolveUri instead.
*/
export declare const ResolveUri: typeof resolveUri;
/**
* @deprecated use parentFolderUri instead.
*/
export declare const ParentFolderUri: typeof parentFolderUri;
/**
* @deprecated use makeRelativeUri instead.
*/
export declare const MakeRelativeUri: typeof makeRelativeUri;
//# sourceMappingURL=uri-manipulation.d.ts.map