How to get folder path in javascript
I am trying to get the directory location of a file, and I'm not sure how to get it. I can't seem to find a module that allows me to do this. Show So for example say I have this string:
how can I get this:
I know I can use something like this:
But I am not sure if that is as good of a method as something that might be built in to node. I have also tried:
and the result doesn't return what I am looking for, that gets the full path including the filename. So, is there something built into node that can do this and do it well? The Parameters
A string representing an absolute path or a path relative to the directory on which the method is called, describing which directory entry to return. Absolute paths may not be able to be used, for security reasons. options OptionalAn object which allows you to specify whether or not to create the entry if it's missing and if it's an error if the file already exists. These options are currently not useful in Web contexts. See the options parameter section for more details. successCallback Optional A method to be called once the errorCallback Optional A method to be called if an error occurs. Receives as its sole input parameter a
|
Specification |
---|
File and Directory Entries API # dom-filesystemdirectoryentry-getdirectory |
Browser compatibility
BCD tables only load in the browser