.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tempy / readme.md
1 # tempy [![Build Status](https://travis-ci.org/sindresorhus/tempy.svg?branch=master)](https://travis-ci.org/sindresorhus/tempy)
2
3 > Get a random temporary file or directory path
4
5
6 ## Install
7
8 ```
9 $ npm install tempy
10 ```
11
12
13 ## Usage
14
15 ```js
16 const tempy = require('tempy');
17
18 tempy.file();
19 //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4f504b9edb5ba0e89451617bf9f971dd'
20
21 tempy.file({extension: 'png'});
22 //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/a9fb0decd08179eb6cf4691568aa2018.png'
23
24 tempy.file({name: 'unicorn.png'});
25 //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/f7f62bfd4e2a05f1589947647ed3f9ec/unicorn.png'
26
27 tempy.directory();
28 //=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
29 ```
30
31
32 ## API
33
34 ### tempy.file([options])
35
36 Get a temporary file path you can write to.
37
38 #### options
39
40 Type: `Object`
41
42 *You usually won't need either the `extension` or `name` option. Specify them only when actually needed.*
43
44 ##### extension
45
46 Type: `string`
47
48 File extension.
49
50 ##### name
51
52 Type: `string`
53
54 Filename. Mutually exclusive with the `extension` option.
55
56 ### tempy.directory()
57
58 Get a temporary directory path. The directory is created for you.
59
60 ### tempy.root
61
62 Get the root temporary directory path. For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`
63
64
65 ## FAQ
66
67 ### Why doesn't it have a cleanup method?
68
69 The operating system will clean up when needed. No point in us wasting resources and adding complexity.
70
71
72 ## Related
73
74 - [temp-write](https://github.com/sindresorhus/temp-write) - Write string/buffer/stream to a random temp file
75
76
77 ## License
78
79 MIT © [Sindre Sorhus](https://sindresorhus.com)