source: frontend/node_modules/tempy/readme.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[9af201e]1# tempy [![Build Status](https://travis-ci.com/sindresorhus/tempy.svg?branch=master)](https://travis-ci.com/github/sindresorhus/tempy)
2
3> Get a random temporary file or directory path
4
5## Install
6
7```
8$ npm install tempy
9```
10
11## Usage
12
13```js
14const tempy = require('tempy');
15
16tempy.file();
17//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4f504b9edb5ba0e89451617bf9f971dd'
18
19tempy.file({extension: 'png'});
20//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/a9fb0decd08179eb6cf4691568aa2018.png'
21
22tempy.file({name: 'unicorn.png'});
23//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/f7f62bfd4e2a05f1589947647ed3f9ec/unicorn.png'
24
25tempy.directory();
26//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
27
28tempy.directory({prefix: 'name'});
29//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/name_3c085674ad31223b9653c88f725d6b41'
30```
31
32## API
33
34### tempy.file(options?)
35
36Get a temporary file path you can write to.
37
38#### options
39
40Type: `object`
41
42*You usually won't need either the `extension` or `name` option. Specify them only when actually needed.*
43
44##### extension
45
46Type: `string`
47
48File extension.
49
50##### name
51
52Type: `string`
53
54Filename. Mutually exclusive with the `extension` option.
55
56### tempy.directory([options])
57
58Get a temporary directory path. The directory is created for you.
59
60#### options
61
62Type: `Object`
63
64##### prefix
65
66
67Type: `string`
68
69Directory prefix.
70
71Useful for testing by making it easier to identify cache directories that are created.
72
73*You usually won't need this option. Specify it only when actually needed.*
74
75### tempy.write(fileContent, options?)
76
77Write data to a random temp file.
78
79##### fileContent
80
81Type: `string | Buffer | TypedArray | DataView | stream.Readable`
82
83Data to write to the temp file.
84
85##### options
86
87See [options](#options).
88
89### tempy.writeSync(fileContent, options?)
90
91Synchronously write data to a random temp file.
92
93##### fileContent
94
95Type: `string | Buffer | TypedArray | DataView`
96
97Data to write to the temp file.
98
99##### options
100
101See [options](#options).
102
103### tempy.root
104
105Get 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
111Temp 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.
Note: See TracBrowser for help on using the repository browser.