The filestore-disk/utils module returns a map of utility functions used throughout the filestore.
- Source:
Requires
Methods
-
<static> getStats(baseDir, filePath) → {external:q}
-
This function gets the file stats from the path specified, normalizes it using the normalizeStats function and returns it.
Parameters:
Name Type Description baseDir
String the root directory for the filestore
filePath
String the path of the file or directory whose stat is to be fetched
- Source:
Returns:
A promise that gets resolved by the Stats object once the stats are fetched and normalized. In case of an error, the promise is rejected with the error.
- Type
- external:q
-
<static> normalizeStats(stats, filePath) → {module:filestore-disk/utils~Stats}
-
This function takes node file stats and normalizes it for use by the filestore
Parameters:
Name Type Description stats
fs.Stats the node file stats object
filePath
String the path of the file whose stat is to be normalized
- Source:
Returns:
the stats object
Type Definitions
-
Stats
-
The Stats object is a normalized file metadata that is used by filestore
Type:
- object
- Source:
Properties:
Name Type Description name
String The base name (including extension) of the file
extension
string The file extension
path
string filestore-relative path of the file
type
String the type of the file, can be F (for file), D (for directories) or L (for links)
size
Number the size of the file
created
Date when was the file created
modified
Date when was the file last modified