Skip to content

Commit bf1fe46

Browse files
mithun-daaMyles Borins
authored andcommitted
doc: Add windows example for Path.format
PR-URL: #5700 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 78effc3 commit bf1fe46

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

doc/api/path.markdown

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ string will be the contents of the `base` property.
100100
If the `base` property is not supplied, a concatenation of the `name` property
101101
and the `ext` property will be used as the `base` property.
102102

103+
Examples:
104+
105+
An example on Posix systems:
106+
103107
```js
104108
path.format({
105109
root : "/",
@@ -120,6 +124,19 @@ path.format({
120124
// returns '/file.txt'
121125
```
122126

127+
An example on Windows:
128+
129+
```js
130+
path.format({
131+
root : "C:\\",
132+
dir : "C:\\path\\dir",
133+
base : "file.txt",
134+
ext : ".txt",
135+
name : "file"
136+
})
137+
// returns 'C:\\path\\dir\\file.txt'
138+
```
139+
123140
## path.isAbsolute(path)
124141

125142
Determines whether `path` is an absolute path. An absolute path will always

0 commit comments

Comments
 (0)