Filesystem operations. Access via the global app.filesystem.

Filesystem

Constructors

Methods

  • Adds network resource

    Parameters

    • path: string

      Path of the resource to add

    Returns Promise<any>

  • Copy file.

    Parameters

    • src: string

      Source filename

    • dst: string

      New filename

    Returns Promise<any>

    Promise is fulfilled when action is completed.

  • Copy files.
    NOTE: Starting from version 5.0.4 accepts also StringList as first param

    Parameters

    • srcList: Tracklist | StringList

      Source file list

    • destFolder: string

      Destination folder

    • Optional addToDB: boolean

      Tracks will be added to database

    • Optional dontShowOverwritePrompt: boolean

      Prompt to overwrite won't be shown

    • Optional dontShowErrors: boolean

      Error log won't be shown

    Returns Promise<any>

    Promise is fulfilled when action is completed.

  • Copy/Move folder.

    Parameters

    • path: string

      Folder to copy/move

    • destination: string

      Target folder where to copy/move

    • Optional params: {
          all?: boolean;
          db?: boolean;
          move?: boolean;
          recursive?: boolean;
      }

      Copy/Move parameters

      • Optional all?: boolean

        Undocumented

      • Optional db?: boolean

        Undocumented

      • Optional move?: boolean

        Undocumented

      • Optional recursive?: boolean

        Undocumented

    Returns Promise<any>

  • Modifies string so that can be used as filename. i.e. Removes illegal filename chars.

    Parameters

    • filename: string

      Path to convert

    Returns string

    corrected path version

  • Creates folder and returns as SharedFolder in Promise fullfillment

    Parameters

    • path: string

      Path of the folder to create

    Returns Promise<any>

  • Deletes a file. It's LEGACY, use deleteFileAsync instead!

    Parameters

    • src: string

    Returns boolean

  • Delete file.

    Parameters

    • fileName: string

      Path of file to delete

    Returns Promise<any>

  • Parameters

    • path: string

    Returns void

    Undocumented

  • Delete folder.

    Parameters

    • path: string | StringList

      Folder to delete

    • recycle: boolean

      To recycle bin

    • Optional onlyEmpty: boolean

      Only if the folder has no other non-media content

    • Optional dontDeleteFromDB: boolean

      Deletes the content, but not from the MM database (leaving deadlinks there) -- Aadded in 5.0.4

    Returns Promise<any>

  • Removes network resource

    Parameters

    Returns Promise<any>

  • Returns true, if directory exists. Note: It's LEGACY, was replaced by dirExistsAsync

    Parameters

    • path: string

      Path to the directory.

    Returns boolean

  • Returns true as first promise param (if directory exists).

    Parameters

    • path: string

      Path to the directory.

    Returns Promise<boolean>

  • Returns true as first promise param (if directory exists).

    Parameters

    • path: string

      Path to the file.

    Returns Promise<any>

  • Gets tracklist from filenames list

    Parameters

    Returns Tracklist

  • Gets application path to executable

    Returns string

  • Gets list of all supported audio extensions.

    Returns StringList

  • Parameters

    • Rest ...params: any[]

    Returns StringList

    Undocumented

  • Returns Promise<any>

    Undocumented

  • Gets list of track's folders.

    Parameters

    • parentID: number

      Parent Folder ID

    • collectionID: number

      Collection ID

    Returns DBFolderList

  • Gets MediaMonkey data folder

    Returns string

  • Returns free/total space in bytes

    Parameters

    • path: string

      Path to the directory.

    Returns Promise<{
        spaceFree: number;
        spaceTotal: number;
    }>

  • Gets file content or a specified portion

    Parameters

    • fileName: string

      File path of the file

    • Optional from: number

      from position in bytes

    • Optional to: number

      to position in bytes

    Returns Promise<FileBuffer>

  • Parameters

    • fullname: string

    Returns string

    Undocumented

  • Gets file info like dateCreated, dateModified, dateAccessed, size as JSON
    date values are in the ISO format, see app.filesystem.timestamp2DateTime and app.utils.dateTime2Timestamp for the conversion

    Parameters

    • fileName: string

      File path of the file

    Returns Promise<any>

    promise with param fileInfo (JSON format)

    Example

    var jsonInfo = await app.filesystem.getFileInfoAsync(track.path);
    var info = JSON.parse( jsonInfo);
    console.log( info.dateModified);
  • Gets file size in bytes

    Parameters

    • fileName: string

      File path of the file

    Returns Promise<number>

  • Parameters

    • path: string

    Returns string

    Undocumented

  • Returns the folder as SharedFolder object

    Parameters

    • path: string

      Path of the folder to get

    • Optional isTemporary: boolean

    Returns SharedFolder

  • Gets folder of path

    Parameters

    • path: string

    Returns Promise<any>

    with folder object

  • Gets list folders for given path as StringList

    Parameters

    • path: string

    Returns Promise<any>

  • Gets folder containing icons

    Returns string

  • Gets last scanned folders

    Returns StringList

  • Returns path separator for the current OS

    Returns string

  • Gets list of all supported playlist extensions.

    Returns StringList

  • Parameters

    • Rest ...params: any[]

    Returns StringList

    Undocumented

  • Parameters

    • global: boolean

    Returns string

    Undocumented

  • Returns string

    Undocumented

  • Gets system folder for music

    Returns string

  • Gets system folder for video

    Returns string

  • Gets user personal folder

    Returns string

  • Gets list of all supported video extensions.

    Returns StringList

  • Parameters

    • Rest ...params: any[]

    Returns StringList

    Undocumented

  • Returns whether this file type (extensions) is associated with MediaMonkey

    Parameters

    • ext: string

    Returns boolean

  • Parameters

    • params: {
          callback?: (() => void);
          file: string;
      }
      • Optional callback?: (() => void)

        Undocumented

          • (): void
          • Returns void

      • file: string

        Undocumented

    Returns SharedResponse

    Undocumented

  • Load text from file.

    Parameters

    • fileName: string

      full path to the file to load

    • Optional params: {
          encoding?: TextEncoding;
      }

      Object containing additional parameters.

    Returns Promise<string>

  • Process located files and update them in database.

    Parameters

    Returns Promise<any>

  • Renames file. It's LEGACY, use renameFileAsync instead!

    Parameters

    • src: string
    • dst: string

    Returns boolean

  • Rename file.

    Parameters

    • src: string

      Source filename

    • dst: string

      New filename

    • OverwritePrompt: boolean

      Overwrites with prompting

    Returns Promise<any>

    Promise is fulfilled when action is completed.

  • Alias of renameFilesAsync.

    Parameters

    • Rest ...params: any[]

    Returns Promise<any>

  • Move or copy list of files.
    Starting from version 5.0.4 moves also non-media files and accepts also StringList as first param
    Prior to version 5.0.4 the function was named just renameFiles

    Parameters

    • srcList: Tracklist | StringList

      Source file list

    • destFolder: string

      Destination folder or dest. filename

    • Optional params: {
          addDB?: boolean;
          canRemoveEmptyFolders?: boolean;
          changeFileName?: boolean;
          move?: boolean;
      }

      Object containing additional parameters. Possible properties are:

      • Optional addDB?: boolean

        Undocumented

      • Optional canRemoveEmptyFolders?: boolean

        Undocumented

      • Optional changeFileName?: boolean

        Undocumented

      • Optional move?: boolean

        Undocumented

    Returns Promise<any>

  • Save text to file.

    Parameters

    • fileName: string

      full path to the file to save

    • text: string

      text to save

    • Optional params: {
          append?: boolean;
          encoding?: string;
      }

      Object containing additional parameters. Possible properties are:

      • Optional append?: boolean

        Undocumented

      • Optional encoding?: string

        Undocumented

    Returns Promise<void>

  • Scan selected path for media files.

    Parameters

    • pathsToScan: StringList

      Paths to scan

    • containers: SharedList<ServerContainer>

      Server containers to scan

    • exts: string

      Extensions to scan (comma separated).

    • params: any

      Additional parameters

    Returns Promise<any>

  • Scan selected tracks for their new location.

    Parameters

    Returns Promise<any>

  • Sets file content for a specified portion of data

    Parameters

    • content: FileBuffer

      buffer data to write

    • fileName: string

      File path of the file

    • Optional from: number

      from position in bytes (0 by default)

    Returns Promise<Promise<void>>

  • Sets file info like dateModified, readOnly date values are in the ISO format, see app.filesystem.timestamp2DateTime and app.utils.dateTime2Timestamp for the conversion
    NOTE: Introduced in 5.0.4

    Parameters

    • fileName: string

      File path of the file

    • params: string

      Params to be set in JSON format

    Returns Promise<any>

    result

    Example

    app.filesystem.setFileInfoAsync( 'C:\\Temp\\file.txt', '{"dateModified":"2020-02-02 22:22:22", "readOnly":"true"}');
    
  • Sets last scanned folders

    Parameters

    Returns void

  • Parameters

    Returns void

    Undocumented

  • Parameters

    Returns void

    Undocumented

  • Scan selected path for media files.

    Parameters

    • path: string

      Path to scan

    Returns Promise<any>

  • Starts auto scanner

    Returns void

  • On Windows returns the short path version used by programs that require the earlier 8.3 file naming convention
    NOTE: Introduced in 5.0.4

    Parameters

    • filename: string

    Returns string

    short path version