How does node get the parent directory path of the current file?

  node.js, question

What I know is these two variables

__filename: module.filename。
__dirname: the directory where the line of code is located.

But what if I want to get the superior directory?
I did not find the relevant method after searching, what I think now is to process the path string obtained by __dirname, according to\Perform segmentation or regularization processing

var path = require('path')
 path.resolve(__dirname, '..')