javascript - Identifying the File System Root with Node.js -


i'm doing basic operation start given directory, , traverse filesystem until hit root. on linux/mac, root / , on windows can c:\ or drive letter of course. question whether or not there way node.js identify root directory of filesystem is.

currently, i'm resorting checking last directory against path.normalize(dir + "/../") see if stops changing. there process property/method out there? maybe module?

would not work?

var path = require("path"); var os = require("os"); var root = (os.platform == "win32") ? process.cwd().split(path.sep)[0] : "/" 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -