OpenVeo server API for plugins

API Docs for: 3.0.0
Show:

fileSystem

Defined in: lib/fileSystem.js:3
Module: fileSystem

Summary

Provides functions to interact with the file system as an extension to the Node.js filesystem module.

Methods

copy

Syntax

copy

(
  • sourcePath
  • destinationSourcePath
  • callback
)
async

Summary

Copies a file or a directory.

Parameters:

  • sourcePath String

    Path of the source to copy

  • destinationSourcePath String

    Final path of the source

  • callback Function

    The function to call when done

    • Error The error if an error occurred, null otherwise

copyFile

Syntax

copyFile

(
  • sourceFilePath
  • destinationFilePath
  • callback
)
private async

Summary

Copies a file.

If directory does not exist it will be automatically created.

Parameters:

  • sourceFilePath String

    Path of the file

  • destinationFilePath String

    Final path of the file

  • callback Function

    The function to call when done

    • Error The error if an error occurred, null otherwise

extract

Syntax

extract

(
  • filePath
  • destinationPath
  • [callback]
)
async

Summary

Extracts a tar file to the given directory.

Parameters:

  • filePath String

    Path of the file to extract

  • destinationPath String

    Path of the directory where to extract files

  • [callback] Function optional

    The function to call when done

    • Error The error if an error occurred, null otherwise

getConfDir

Syntax

getConfDir

() String

Summary

Gets OpenVeo configuration directory path.

OpenVeo configuration is stored in user home directory.

Returns:

String:

OpenVeo configuration directory path

getJSONFileContent

Syntax

getJSONFileContent

(
  • filePath
  • callback
)
async

Summary

Gets a JSON file content.

This will verify that the file exists first.

Parameters:

  • filePath String

    The path of the file to read

  • callback Function

    The function to call when done

    • Error The error if an error occurred, null otherwise
    • String The file content or null if an error occurred

mkdir

Syntax

mkdir

(
  • directoryPath
  • [callback]
)
async

Summary

Creates a directory.

If parent directory does not exist, it will be automatically created. If directory already exists, it won't do anything.

Parameters:

  • directoryPath String

    The directory system path to create

  • [callback] Function optional

    The function to call when done

    • Error The error if an error occurred, null otherwise

mkdirRecursive

Syntax

mkdirRecursive

(
  • directoryPath
  • callback
)
private async

Summary

Creates a directory recursively and asynchronously.

If parent directories do not exist, they will be automatically created.

Parameters:

  • directoryPath String

    The directory system path to create

  • callback Function

    The function to call when done

    • Error The error if an error occurred, null otherwise

rmdir

Syntax

rmdir

(
  • directoryPath
  • [callback]
)
async

Summary

Removes a directory and all its content recursively and asynchronously.

Parameters:

  • directoryPath String

    Path of the directory to remove

  • [callback] Function optional

    The function to call when done

    • Error The error if an error occurred, null otherwise

rmdirRecursive

Syntax

rmdirRecursive

(
  • directoryPath
  • callback
)
private async

Summary

Removes a directory and all its content recursively and asynchronously.

It is assumed that the directory exists.

Parameters:

  • directoryPath String

    Path of the directory to remove

  • callback Function

    The function to call when done

    • Error The error if an error occurred, null otherwise