Get directory of a file name in Javascript

前端 未结 9 1700
囚心锁ツ
囚心锁ツ 2021-01-17 07:41

How to get the directory of a file?

For example, I pass in a string

C:\\Program Files\\nant\\bin\\nant.exe

I want a function that r

9条回答
  •  不知归路
    2021-01-17 08:28

    If you use typescript, path module is quite handy.

    path.dirname("/home/workspace/filename.txt") // '/home/workspace/'
    

提交回复
热议问题