mkstemp
mkstemp(
suffix:string,prefix:string,dir?:string,_text?:boolean):Promise<[FileHandle,string]>
Defined in: packages/pythonlib/src/tempfile.node.ts:59
Create a temporary file and return a tuple of (handle, path).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
suffix | string | "" | Optional suffix for the filename |
prefix | string | "tmp" | Optional prefix for the filename (default: “tmp”) |
dir? | string | undefined | Optional directory (default: system temp dir) |
_text? | boolean | false | - |
Returns
Promise<[FileHandle, string]>
Promise of tuple [FileHandle, path]
Example
const [handle, path] = await mkstemp(".txt", "myapp-")await handle.write(Buffer.from("data"))await handle.close()