58 lines
2.8 KiB
TypeScript
58 lines
2.8 KiB
TypeScript
import { URI } from './uri';
|
|
export declare namespace Utils {
|
|
/**
|
|
* Joins one or more input paths to the path of URI.
|
|
* '/' is used as the directory separation character.
|
|
*
|
|
* The resolved path will be normalized. That means:
|
|
* - all '..' and '.' segments are resolved.
|
|
* - multiple, sequential occurences of '/' are replaced by a single instance of '/'.
|
|
* - trailing separators are preserved.
|
|
*
|
|
* @param uri The input URI.
|
|
* @param paths The paths to be joined with the path of URI.
|
|
* @returns A URI with the joined path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.
|
|
*/
|
|
function joinPath(uri: URI, ...paths: string[]): URI;
|
|
/**
|
|
* Resolves one or more paths against the path of a URI.
|
|
* '/' is used as the directory separation character.
|
|
*
|
|
* The resolved path will be normalized. That means:
|
|
* - all '..' and '.' segments are resolved.
|
|
* - multiple, sequential occurences of '/' are replaced by a single instance of '/'.
|
|
* - trailing separators are removed.
|
|
*
|
|
* @param uri The input URI.
|
|
* @param paths The paths to resolve against the path of URI.
|
|
* @returns A URI with the resolved path. All other properties of the URI (scheme, authority, query, fragments, ...) will be taken from the input URI.
|
|
*/
|
|
function resolvePath(uri: URI, ...paths: string[]): URI;
|
|
/**
|
|
* Returns a URI where the path is the directory name of the input uri, similar to the Unix dirname command.
|
|
* In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.
|
|
* The orignal URI is returned if the URIs path is empty or does not contain any path segments.
|
|
*
|
|
* @param uri The input URI.
|
|
* @return The last segment of the URIs path.
|
|
*/
|
|
function dirname(uri: URI): URI;
|
|
/**
|
|
* Returns the last segment of the path of a URI, similar to the Unix basename command.
|
|
* In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.
|
|
* The empty string is returned if the URIs path is empty or does not contain any path segments.
|
|
*
|
|
* @param uri The input URI.
|
|
* @return The base name of the URIs path.
|
|
*/
|
|
function basename(uri: URI): string;
|
|
/**
|
|
* Returns the extension name of the path of a URI, similar to the Unix extname command.
|
|
* In the path, '/' is recognized as the directory separation character. Trailing directory separators are ignored.
|
|
* The empty string is returned if the URIs path is empty or does not contain any path segments.
|
|
*
|
|
* @param uri The input URI.
|
|
* @return The extension name of the URIs path.
|
|
*/
|
|
function extname(uri: URI): string;
|
|
}
|