From 0ffd794b27b9c65fe40d46c68edcc9b319aac303 Mon Sep 17 00:00:00 2001 From: Mithun Patel Date: Mon, 14 Mar 2016 10:50:50 -0500 Subject: [PATCH] doc: Add windows example for Path.format PR-URL: https://github.com/nodejs/node/pull/5700 Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Conflicts: doc/api/path.markdown --- doc/api/path.markdown | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/api/path.markdown b/doc/api/path.markdown index 04ad63c889cced..655f90ec21b1bb 100644 --- a/doc/api/path.markdown +++ b/doc/api/path.markdown @@ -100,6 +100,8 @@ 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. +An example on Posix systems: + ```js path.format({ root : "/", @@ -111,6 +113,19 @@ path.format({ // returns '/home/user/dir/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