fileSystem
Summary
Defines functions to interact with the file system as an extension to the Node.js filesystem module.
// Load module "fileSystem"
var fsApi = require('@openveo/api').fileSystem;
Item Index
Methods
- copy static
- copyFile static
- extract static
- getConfDir static
- getFileTypeFromBuffer static
- getJSONFileContent static
- mkdir static
- mkdirRecursive static
- readdir static
- readdirRecursive static
- readFile static
- rm static
- rmdir static deprecated
- rmdirRecursive static
Properties
Methods
copy
Syntax
copy
-
sourcePath
-
destinationSourcePath
-
callback
Summary
Copies a file or a directory.
copyFile
Syntax
copyFile
-
sourceFilePath
-
destinationFilePath
-
callback
Summary
Copies a file.
If directory does not exist it will be automatically created.
extract
Syntax
extract
-
filePath
-
destinationPath
-
[callback]
Summary
Extracts a tar file to the given directory.
getConfDir
Syntax
Summary
Gets OpenVeo configuration directory path.
OpenVeo configuration is stored in user home directory.
Returns:
OpenVeo configuration directory path
getFileTypeFromBuffer
Syntax
Summary
Gets file type.
Parameters:
-
file
BufferAt least the first 300 bytes of the file
Returns:
The file type
getJSONFileContent
Syntax
getJSONFileContent
-
filePath
-
callback
Summary
Gets a JSON file content.
This will verify that the file exists first.
mkdir
Syntax
mkdir
-
directoryPath
-
[callback]
Summary
Creates a directory.
If parent directory does not exist, it will be automatically created. If directory already exists, it won't do anything.
mkdirRecursive
Syntax
mkdirRecursive
-
directoryPath
-
callback
Summary
Creates a directory recursively and asynchronously.
If parent directories do not exist, they will be automatically created.
readdir
Syntax
readdir
-
directoryPath
-
callback
Summary
Gets the content of a directory recursively and asynchronously.
readdirRecursive
Syntax
readdirRecursive
-
directoryPath
-
callback
Summary
Reads a directory content recursively and asynchronously.
It is assumed that the directory exists.
readFile
Syntax
readFile
-
filePath
-
[offset]
-
[length]
-
callback
Summary
Gets part of a file as bytes.
Parameters:
-
filePath
StringPath of the file
-
[offset]
Number optionalSpecify where to begin reading from in the file
-
[length]
Number optionalThe number of bytes ro read
-
callback
FunctionThe function to call when done
- Error The error if an error occurred, null otherwise
- Buffer The buffer containing read bytes
rm
Syntax
rm
-
resourcePath
-
[callback]
Summary
Removes a resource.
If resource is a directory, the whole directory is removed.
rmdir
Syntax
rmdir
-
directoryPath
-
[callback]
Summary
Removes a directory and all its content recursively and asynchronously.
rmdirRecursive
Syntax
rmdirRecursive
-
directoryPath
-
callback
Summary
Removes a directory and all its content recursively and asynchronously.
It is assumed that the directory exists.