aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/util/path-to-file-url.md
blob: 202be61eb032bda04ce8e766377cc0af835708aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
name: Convert an absolute path to a file URL
---

Use `Bun.pathToFileURL()` to convert an absolute path to a `file://` URL.

```ts
Bun.pathToFileURL("/path/to/file.txt");
// => "file:///path/to/file.txt"
```

---

See [Docs > API > Utils](/docs/api/utils) for more useful utilities.
t/src/javascript/jsc/node/types.zig?h=dylan/github-api-option&id=b2a69a35b8887c233c606e9f2e7ebec35f82a65e&follow=1'>Slight improvement to non-ascii file path handlingGravatar Jarred Sumner 4-18/+79 2022-02-02`path.relative` passes Node's tests (which also fixed bugs)Gravatar Jarred Sumner 8-283/+571