2
2
import { MergeExclusive , TypedArray } from 'type-fest' ;
3
3
4
4
declare namespace tempy {
5
- type Options = MergeExclusive <
5
+ type FileOptions = MergeExclusive <
6
6
{
7
7
/**
8
8
File extension.
@@ -24,6 +24,17 @@ declare namespace tempy {
24
24
readonly name ?: string ;
25
25
}
26
26
> ;
27
+
28
+ type DirectoryOptions = {
29
+ /**
30
+ _You usually won't need this option. Specify it only when actually needed._
31
+
32
+ Directory prefix.
33
+
34
+ Useful for testing by making it easier to identify cache directories that are created.
35
+ */
36
+ readonly prefix ?: string ;
37
+ }
27
38
}
28
39
29
40
declare const tempy : {
@@ -47,7 +58,7 @@ declare const tempy: {
47
58
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
48
59
```
49
60
*/
50
- file ( options ?: tempy . Options ) : string ;
61
+ file ( options ?: tempy . FileOptions ) : string ;
51
62
52
63
/**
53
64
Get a temporary directory path. The directory is created for you.
@@ -58,9 +69,12 @@ declare const tempy: {
58
69
59
70
tempy.directory();
60
71
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
72
+
73
+ tempy.directory({prefix: 'a'});
74
+ //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/name_3c085674ad31223b9653c88f725d6b41'
61
75
```
62
76
*/
63
- directory ( ) : string ;
77
+ directory ( options ?: tempy . DirectoryOptions ) : string ;
64
78
65
79
/**
66
80
Write data to a random temp file.
@@ -73,7 +87,7 @@ declare const tempy: {
73
87
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
74
88
```
75
89
*/
76
- write ( fileContent : string | Buffer | TypedArray | DataView | NodeJS . ReadableStream , options ?: tempy . Options ) : Promise < string > ;
90
+ write ( fileContent : string | Buffer | TypedArray | DataView | NodeJS . ReadableStream , options ?: tempy . FileOptions ) : Promise < string > ;
77
91
78
92
/**
79
93
Synchronously write data to a random temp file.
@@ -86,7 +100,7 @@ declare const tempy: {
86
100
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
87
101
```
88
102
*/
89
- writeSync ( fileContent : string | Buffer | TypedArray | DataView , options ?: tempy . Options ) : string ;
103
+ writeSync ( fileContent : string | Buffer | TypedArray | DataView , options ?: tempy . FileOptions ) : string ;
90
104
91
105
/**
92
106
Get the root temporary directory path.
0 commit comments