TemporaryFile
Temporary file object constructor that supports reopening of the temporary file in Windows.
Attributes
| Attribute | Type | Description |
|---|---|---|
| unlink | callable | Cached reference to the os.unlink function used to delete the temporary file from the filesystem during cleanup. |
Constructor
Signature
def TemporaryFile(
mode: string = "w+b",
bufsize: integer = -1,
suffix: string = "",
prefix: string = "",
dir: string = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| mode | string = "w+b" | The mode in which the file is opened. |
| bufsize | integer = -1 | The buffer size used when opening the file. |
| suffix | string = "" | The suffix to use for the temporary file name. |
| prefix | string = "" | The prefix to use for the temporary file name. |
| dir | string = null | The directory in which to create the temporary file. |
Signature
def TemporaryFile(
mode: string = w+b,
bufsize: integer = -1,
suffix: string,
prefix: string,
dir: string = null
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| mode | string = w+b | The file mode used to open the temporary file, such as 'w+b' for binary read/write access. |
| bufsize | integer = -1 | The buffer size for the file object; -1 indicates the system default buffering. |
| suffix | string | A string to append to the end of the temporary file name. |
| prefix | string | A string to prepend to the beginning of the temporary file name. |
| dir | string = null | The directory path where the temporary file will be created. |
Methods
close()
@classmethod
def close() - > null
Closes the underlying file handle and deletes the file from the filesystem if it has not already been closed.
Returns
| Type | Description |
|---|---|
null |