Skip to main content

TemporaryFile

Temporary file object constructor that supports reopening of the temporary file in Windows.

Attributes

AttributeTypeDescription
unlinkcallableCached 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

NameTypeDescription
modestring = "w+b"The mode in which the file is opened.
bufsizeinteger = -1The buffer size used when opening the file.
suffixstring = ""The suffix to use for the temporary file name.
prefixstring = ""The prefix to use for the temporary file name.
dirstring = nullThe 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

NameTypeDescription
modestring = w+bThe file mode used to open the temporary file, such as 'w+b' for binary read/write access.
bufsizeinteger = -1The buffer size for the file object; -1 indicates the system default buffering.
suffixstringA string to append to the end of the temporary file name.
prefixstringA string to prepend to the beginning of the temporary file name.
dirstring = nullThe 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

TypeDescription
null