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
- overwolf.extensions.io.createDirectory()
- overwolf.extensions.io.getStoragePath()
- overwolf.extensions.io.exist()
- overwolf.extensions.io.move()
- overwolf.extensions.io.delete()
- overwolf.extensions.io.copy()
- overwolf.extensions.io.dir()
- overwolf.extensions.io.readTextFile()
- overwolf.extensions.io.writeTextFile()
Types Reference
- overwolf.extensions.io.enums.FileType enum
- overwolf.extensions.io.enums.StorageSpace enum
- overwolf.extensions.io.Content Object
- overwolf.extensions.io.ReadTextFileResult Object
- overwolf.extensions.io.ExistResult Object
- overwolf.extensions.io.GetStoragePathResult Object
- overwolf.extensions.io.DirResult Object
- overwolf.extensions.io.DeleteResult Object
createDirectory(space, path, callback)
Version added: 0.147
Create directory.
| Parameter | Type | Description |
|---|---|---|
| space | StorageSpace enum | The selected storage space. |
| path | string | Path within the space. Use null or empty string for the space root. |
| callback | (Result) => void | Reports 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.
| Parameter | Type | Description |
|---|---|---|
| space | StorageSpace enum | The selected storage space. |
| callback | (Result: GetStoragePathResult) => void | Returns 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.
| Parameter | Type | Description |
|---|---|---|
| space | StorageSpace enum | The selected storage space. |
| path | string | Path within the space. Use null or empty string for the space root. |
| callback | (Result: ExistResult) => void | Returns 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.
| Parameter | Type | Description |
|---|---|---|
| space | StorageSpace enum | The selected storage space. |
| source | string | Path for the source. |
| destination | string | Path to move to, including filename. |
| callback | (Result) => void | Reports 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.
| Parameter | Type | Description |
|---|---|---|
| space | StorageSpace enum | The selected storage space. |
| path | string | Path within the space. Use null or empty string for the space root. |
| callback | (Result: DeleteResult) => void | Returns with array of file and directory paths that could not be deleted. |