目录

File

Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.

Definition

API

Description

qg.getFileSystemManager()

Obtains the globally unique file manager. The FileSystemManager object is returned.

FileSystemManager.access(Object object)

Checks whether a file or directory exists.

FileSystemManager.accessSync(string path)

Checks whether a file or directory exists in synchronous mode.

FileSystemManager.copyFile(Object object)

Copies a file.

FileSystemManager.copyFileSync(string srcPath, string destPath)

Copies a file in synchronous mode.

FileSystemManager.mkdir(Object object)

Creates a directory.

FileSystemManager.mkdirSync(string dirPath, boolean recursive)

Creates a directory in synchronous mode.

FileSystemManager.rmdir(Object object)

Deletes a directory.

FileSystemManager.rmdirSync(Object object)

Deletes a directory in synchronous mode.

FileSystemManager.readdir(Object object)

Reads the file list of a directory.

Array FileSystemManager.readdirSync(string dirPath)

Reads the file list of a directory in synchronous mode.

FileSystemManager.readFile(Object object)

Reads the content of a local file.

string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding)

Reads the content of a local file in synchronous mode.

FileSystemManager.rename(Object object)

Renames a file. This can also be used to move a file from oldPath to newPath.

FileSystemManager.renameSync(string oldPath, string newPath)

Renames a file in synchronous mode. This can also be used to move a file from oldPath to newPath in synchronous mode.

FileSystemManager.stat(Object object)

Obtains the stats object of a file.

Stats|Array FileSystemManager.statSync(string path, boolean recursive)

Obtains the stats object of a file in synchronous mode.

FileSystemManager.unlink(Object object)

Deletes a file.

FileSystemManager.unlinkSync(string path)

Deletes a file in synchronous mode.

FileSystemManager.unzip(Object object)

Decompresses a file.

FileSystemManager.writeFile(Object object)

Writes data to a file. The original content will be overwritten by the new content.

FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)

Writes data to a file in synchronous mode.

FileSystemManager.saveFile(Object object)

Saves a temporary file to a local path.

FileSystemManager.saveFileSync(string tempFilePath, string filePath)

Saves a temporary file to a local path in synchronous mode.

FileSystemManager.appendFile(Object object)

Appends content to a file.

FileSystemManager.appendFileSync(Object object)

Appends content to a file in synchronous mode.

FileSystemManager.getFileInfo(Object object)

Obtains information about a local temporary file or user file.

FileSystemManager.removeSavedFile(Object object)

Deletes local cache files of a quick game.

FileSystemManager.readCompressedFile(Object object)

Reads the content of a local file with a specified compression type.

FileSystemManager.readCompressedFileSync(Object object)

Reads the content of a local file with a specified compression type in synchronous mode.

Stats

Object that describes the file status.

FileStats

Each FileStats object contains path and Stats.

[h2]qg.getFileSystemManager()

[h2]FileSystemManager.access(Object object)

[h2]FileSystemManager.accessSync(string path)

[h2]FileSystemManager.copyFile(Object object)

[h2]FileSystemManager.copyFileSync(string srcPath, string destPath)

[h2]FileSystemManager.mkdir(Object object)

[h2]FileSystemManager.mkdirSync(string dirPath, boolean recursive)

[h2]FileSystemManager.rmdir(Object object)

[h2]FileSystemManager.rmdirSync(Object object)

[h2]FileSystemManager.readdir(Object object)

[h2]Array FileSystemManager.readdirSync(string dirPath)

[h2]FileSystemManager.readFile(Object object)

[h2]string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding)

[h2]FileSystemManager.rename(Object object)

[h2]FileSystemManager.renameSync(string oldPath, string newPath)

[h2]FileSystemManager.stat(Object object)

[h2]Stats|Array FileSystemManager.statSync(string path, boolean recursive)

[h2]FileSystemManager.unlink(Object object)

[h2]FileSystemManager.unlinkSync(string path)

[h2]FileSystemManager.unzip(Object object)

[h2]FileSystemManager.writeFile(Object object)

[h2]FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)

[h2]FileSystemManager.saveFile(Object object)

[h2]FileSystemManager.saveFileSync(string tempFilePath, string filePath)

[h2]FileSystemManager.appendFile(Object object)

[h2]FileSystemManager.appendFileSync(Object object)

[h2]FileSystemManager.getFileInfo(Object object)

[h2]FileSystemManager.removeSavedFile(Object object)

[h2]FileSystemManager.readCompressedFile(Object object)

[h2]FileSystemManager.readCompressedFileSync(Object object)

[h2]Stats

[h2]FileStats

Result Codes

Result Code

Message

Description

-1

unknown error occurred

Unknown error.

0

file operate success

Success.

1

no such file or directory

The file or directory cannot be found.

2

permission denied

Incorrect permission.

3

file already exists

The file already exists.

4

not a directory

Not a file path.

5

not a file

Not a file.

6

the maximum size of the file storage limit is exceeded

The file storage space limit is exceeded.

7

directory not empty

The directory is not empty.

8

create directory fail

Failed to create the file path.

9

unsupported compression algorithm

The file compression type is not supported.

10

decompress fail

Decompression failed. For example, the compressed file is damaged, or the compression algorithm used by the compressed file is different from the input compressionAlgorithm.

Links

[h2]FAQs