doc: Add windows example for Path.format
authorMithun Patel <mithunster@gmail.com>
Mon, 14 Mar 2016 15:50:50 +0000 (10:50 -0500)
committerMyles Borins <mborins@us.ibm.com>
Wed, 30 Mar 2016 20:12:15 +0000 (13:12 -0700)
PR-URL: https://github.com/nodejs/node/pull/5700
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
doc/api/path.markdown

index 3d9fa5b..530dc44 100644 (file)
@@ -100,6 +100,10 @@ string will be the contents of the `base` property.
 If the `base` property is not supplied, a concatenation of the `name` property
 and the `ext` property will be used as the `base` property.
 
+Examples:
+
+An example on Posix systems:
+
 ```js
 path.format({
     root : "/",
@@ -120,6 +124,19 @@ path.format({
 // returns '/file.txt'
 ```
 
+An example on Windows:
+
+```js
+path.format({
+    root : "C:\\",
+    dir : "C:\\path\\dir",
+    base : "file.txt",
+    ext : ".txt",
+    name : "file"
+})
+// returns 'C:\\path\\dir\\file.txt'
+```
+
 ## path.isAbsolute(path)
 
 Determines whether `path` is an absolute path. An absolute path will always