You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `callback` resolves with a temporary file path you can write to. The file is automatically cleaned up after the callback is executed. Returns a promise that resolves after the callback is executed and the file is cleaned up.
41
+
42
+
#### callback
43
+
44
+
Type: `(tempPath: string) => void`
45
+
46
+
A callback that is executed with the temp file path. Can be asynchronous.
47
+
38
48
#### options
39
49
40
50
Type: `object`
@@ -57,13 +67,22 @@ Filename. Mutually exclusive with the `extension` option.
57
67
58
68
Get a temporary directory path. The directory is created for you.
59
69
70
+
### tempy.directory.task(callback, options?)
71
+
72
+
The `callback` resolves with a temporary directory path you can write to. The directory is automatically cleaned up after the callback is executed. Returns a promise that resolves after the callback is executed and the directory is cleaned up.
73
+
74
+
##### callback
75
+
76
+
Type: `(tempPath: string) => void`
77
+
78
+
A callback that is executed with the temp directory path. Can be asynchronous.
79
+
60
80
#### options
61
81
62
82
Type: `Object`
63
83
64
84
##### prefix
65
85
66
-
67
86
Type: `string`
68
87
69
88
Directory prefix.
@@ -76,12 +95,22 @@ Useful for testing by making it easier to identify cache directories that are cr
Write data to a random temp file. The file is automatically cleaned up after the callback is executed. Returns a promise that resolves after the callback is executed and the file is cleaned up.
A callback that is executed with the temp file path. Can be asynchronous.
113
+
85
114
##### options
86
115
87
116
See [options](#options).
@@ -103,9 +132,3 @@ See [options](#options).
103
132
### tempy.root
104
133
105
134
Get the root temporary directory path. For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`
106
-
107
-
## FAQ
108
-
109
-
#### Why doesn't it have a cleanup method?
110
-
111
-
Temp files will be periodically cleaned up on macOS. Most Linux distros will clean up on reboot. If you're generating a lot of temp files, it's recommended to use a complementary module like [`del`](https://github.com/sindresorhus/del) for cleanup.
0 commit comments