I am using Node.js, and I want to obtain the parent directory name for a file. I have the file \"../test1/folder1/FolderIWant/test.txt\".
\"../test1/folder1/FolderIWant/test.txt\"
I want to get
Daniel Wolf's answer is correct, also if you want the full path of the parent dir:
require('path').resolve(__dirname, '..')