Skip to content
Permalink
Newer
Older
100644 34 lines (26 sloc) 708 Bytes
Ignoring revisions in .git-blame-ignore-revs.
1
declare namespace fileUrl {
2
interface Options {
3
/**
4
Passing `false` will make it not call `path.resolve()` on the path.
5
6
@default true
7
*/
8
readonly resolve?: boolean;
9
}
10
}
11
12
/**
13
Convert a file path to a file URL.
14
15
@param filePath - File path to convert.
16
@returns The `filePath` converted to a file URL.
17
18
@example
19
```
20
import fileUrl = require('file-url');
21
22
fileUrl('unicorn.jpg');
23
//=> 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'
24
25
fileUrl('/Users/pony/pics/unicorn.jpg');
26
//=> 'file:///Users/pony/pics/unicorn.jpg'
27
28
fileUrl('unicorn.jpg', {resolve: false});
29
//=> 'file:///unicorn.jpg'
30
```
31
*/
32
declare function fileUrl(filePath: string, options?: fileUrl.Options): string;
33
34
export = fileUrl;