Skip to main content

overwolf.extensions.io API

Use this API to get I/O functionalities for the current extension and access your extension's dedicated storage space like the pictures folder, videos folder, or appData folder.

tip

For general I/O functionalities, use the overwolf.io API. In addition, the simple I/O plugin offers several more general I/O features that are not available through the APIs.

Methods Reference​

Types Reference​

createDirectory(space, path, callback)​

Version added: 0.147​

Create directory.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
pathstringPath within the space. Use null or empty string for the space root.
callback(Result) => voidReports success or failure.

Usage example​

overwolf.extensions.io.createDirectory(overwolf.extensions.io.enums.StorageSpace.appData,"hal9000",console.log)
//==> {success: true}

getStoragePath(space, callback)​

Version added: 0.147​

Returns the full path of given extension storage space.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
callback(Result: GetStoragePathResult) => voidReturns with the full path of the requested extension storage space

Usage example​

overwolf.extensions.io.getStoragePath(overwolf.extensions.io.enums.StorageSpace.appData,console.log)
//==>{path: "C:\Users\Hal9000\AppData\Roaming\Overwolf\nhmkaollkcmjiecdnnjmgfifjgkfegkljnjjbipp", success: true}

exist(space, path, callback)​

Version added: 0.147​

Returns whether the file or folder specified exist.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
pathstringPath within the space. Use null or empty string for the space root.
callback(Result: ExistResult) => voidReturns with the type of the file (if exist).

Usage example​

overwolf.extensions.io.exist(overwolf.extensions.io.enums.StorageSpace.appData,"hal9000",console.log)
//==> "{type": "directory", "success":true}

//you can use full path as well (just add escape slash for backslash)
overwolf.extensions.io.exist(overwolf.extensions.io.enums.StorageSpace.appData,"C:\\Users\\OWUser\\AppData\\Roaming\\Overwolf\\nhmkaollkcmjiecdnnjmgfifjgkfegkljnjjbipp\\hal9000",console.log)
//==> "{type": "directory", "success":true}

move(space, source, destination, callback)​

Version added: 0.147​

Moves source file or directory and its contents to destination.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
sourcestringPath for the source.
destinationstringPath to move to, including filename.
callback(Result) => voidReports success or failure.

Usage example​

overwolf.extensions.io.move(overwolf.extensions.io.enums.StorageSpace.appData,"hal9000\\log.txt","log.txt",console.log)
//==>{"success":true}

delete(space, path, callback)​

Version added: 0.147​

Deletes file or directory and its contents.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
pathstringPath within the space. Use null or empty string for the space root.
callback(Result: DeleteResult) => voidReturns with array of file and directory paths that could not be deleted.

Usage example​

overwolf.extensions.io.delete(overwolf.extensions.io.enums.StorageSpace.appData,"log.txt",console.log)
//==>{success: true}
tip

To delete old videos you can use overwolf.media.videos.deleteOldVideos(), and to delete old gifs you can use [overwolf.media.deleteOldGifs()]/ow-native/reference/media/ow-media#deleteoldgifskeepnewestxgbs-callback).

copy(space, source, destination, callback)​

Version added: 0.147​

Copies source file or directory and its contents to destination.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
sourcestringPath for the source.
destinationstringPath to copy to, including filename.
callback(Result) => voidReports success or failure.

Usage example​

overwolf.extensions.io.copy(overwolf.extensions.io.enums.StorageSpace.appData,"hal9000\\log.txt","log.txt",console.log)
//==>{"success":true}

dir(space, directoryPath, callback)​

Version added: 0.147​

Lists directories and files under given directory path.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
directoryPathstringPath within the space. Use null or empty string for the space root.
callback(Result: DirResult) => voidReturns with array of file names within the directory.

Usage example​

overwolf.extensions.io.dir(overwolf.extensions.io.enums.StorageSpace.appData,"",console.log)
//==>{"files":[],"directories":["hal9000"],"success":true}

readTextFile(space, filePath, callback)​

Version added: 0.147​

Returns the content of a given file.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
filePathstringPath of a file to read (within the space).
callback(Result: ReadTextFileResult) => voidReturns with the content of the fil.

Usage example​

overwolf.extensions.io.readTextFile(overwolf.extensions.io.enums.StorageSpace.appData,"hal9000\\loxg.txt",console.log)

writeTextFile(space, filePath, content, callback)​

Version added: 0.147​

Writes the provided text content to the provided file.

ParameterTypeDescription
spaceStorageSpace enumThe selected storage space.
filePathstringPath of a file to write to (within the space).
contentstringText content to write (added to the end of file, not overwrite the content)
callback(Result) => voidReports success or failure.

Usage example​

overwolf.extensions.io.writeTextFile(overwolf.extensions.io.enums.StorageSpace.appData,"hal9000\\log.txt","add this to your tail",console.log)
//==>{"success":true}

FileType enum​

Version added: 0.147​

FileType is "file"|"directory".

OptionDescription
file
directory

StorageSpace enum​

Version added: 0.147​

The selected storage space.

Note that the default Overwolf's captured pictures and videos folder is the windows "pictures"/"videos" folder.
Of course, the user can change it anytime from the OW client UI.

OptionDescription
picturesThe extension's captured pictures folder, OverwolfPicturesFolder\AppName\
videosThe extension's captured videos folder, OverwolfVideosFolder\AppName\
appDataThe extension's folder under Roaming app data, AppData\Roaming\Overwolf\[Extensions UID]

Content Object​

Version added: 0.147​

ParameterTypeDescription
typeFileType enumFileType is "file" or "directory".
pathstring

ReadTextFileResult Object​

Version added: 0.147​

ParameterTypeDescription
statusstringdeprecated. For backward compatibility only
Reasonstringdeprecated. For backward compatibility only
contentstring

Example data: Success​

{"content":"just a demo text","success":true}

Example data: Failure​

{
"success":false,
"error":"hal9000\\loxg.txt does not exist."
}

ExistResult Object​

Version added: 0.147​

ParameterTypeDescription
statusstringdeprecated. For backward compatibility only
Reasonstringdeprecated. For backward compatibility only
typeFileType enumFileType is "file" or "directory".

Example data: Success​

"{type": "directory", "success":true}

Example data: Failure​

{
"type": "file",
"success": false,
"error": "C:\Users\hal9000\AppData\Roaming\Overwolf\nhm…dnnjmgfifjgkfegkljnjjbipp\DirNameX does not exist."
}

GetStoragePathResult Object​

Version added: 0.147​

ParameterTypeDescription
statusstringdeprecated. For backward compatibility only
Reasonstringdeprecated. For backward compatibility only
pathstringFull path of the requested extension storage space

Example data: Success​

//the path of the extension's app data storage space

{
"path": "C:\Users\Hal9000\AppData\Roaming\Overwolf\nhmkaollkcmjiecdnnjmgfifjgkfegkljnjjbipp",
"success": true
}

Example data: Failure​

DirResult Object​

Version added: 0.147​

ParameterTypeDescription
statusstringdeprecated. For backward compatibility only
Reasonstringdeprecated. For backward compatibility only
filesstring[]Array of file names within the directory.
directoriesstring[]Array of directory names within the directory.

Example data: Success​

{
"files":["hal9000\\log.txt"],
"directories":[],
"success":true
}

Example data: Failure​

{
"success":false,
"error":"Could not find a part of the path 'C:\\Users\\OWUser\\AppData\\Roaming\\Overwolf\\nhmkaollkcmjiecdnnjmgfifjgkfegkljnjjbipp\\hal900'."
}

DeleteResult Object​

Version added: 0.147​

ParameterTypeDescription
successbooleaninherited from the "Result" Object
errorstringinherited from the "Result" Object
statusstringdeprecated. For backward compatibility only
Reasonstringdeprecated. For backward compatibility only
undeleted_contentContent[]Array of file and directory paths that could not be deleted.

Example data: Success​

{"success": "true"}

Example data: Failure​

{
"success": false,
"error": "File or directory do not exist"
}