tempfile 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +4 -7
  2. package/package.json +11 -9
  3. package/readme.md +18 -7
package/index.js CHANGED
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
- var path = require('path');
3
- var osTmpdir = require('os-tmpdir');
4
- var uuid = require('uuid');
5
- var TMP_DIR = osTmpdir();
2
+ const path = require('path');
3
+ const uuid = require('uuid');
4
+ const tempDir = require('temp-dir');
6
5
 
7
- module.exports = function (ext) {
8
- return path.join(TMP_DIR, uuid.v4() + (ext || ''));
9
- };
6
+ module.exports = ext => path.join(tempDir, uuid.v4() + (ext || ''));
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "tempfile",
3
- "version": "1.1.1",
4
- "description": "Get a random temp file path",
3
+ "version": "2.0.0",
4
+ "description": "Get a random temporary file path",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/tempfile",
7
7
  "author": {
8
8
  "name": "Sindre Sorhus",
9
9
  "email": "sindresorhus@gmail.com",
10
- "url": "http://sindresorhus.com"
10
+ "url": "sindresorhus.com"
11
11
  },
12
12
  "engines": {
13
- "node": ">=0.10.0"
13
+ "node": ">=4"
14
14
  },
15
15
  "scripts": {
16
- "test": "mocha"
16
+ "test": "xo && ava"
17
17
  },
18
18
  "files": [
19
19
  "index.js"
@@ -26,13 +26,15 @@
26
26
  "file",
27
27
  "path",
28
28
  "random",
29
- "rand"
29
+ "rand",
30
+ "uuid"
30
31
  ],
31
32
  "dependencies": {
32
- "os-tmpdir": "^1.0.0",
33
- "uuid": "^2.0.1"
33
+ "temp-dir": "^1.0.0",
34
+ "uuid": "^3.0.1"
34
35
  },
35
36
  "devDependencies": {
36
- "mocha": "*"
37
+ "ava": "*",
38
+ "xo": "*"
37
39
  }
38
40
  }
package/readme.md CHANGED
@@ -1,11 +1,13 @@
1
1
  # tempfile [![Build Status](https://travis-ci.org/sindresorhus/tempfile.svg?branch=master)](https://travis-ci.org/sindresorhus/tempfile)
2
2
 
3
- > Get a random temp file path
3
+ > Get a random temporary file path
4
+
5
+ **Checkout out [`tempy`](https://github.com/sindresorhus/tempy) which is better take on this module.**
4
6
 
5
7
 
6
8
  ## Install
7
9
 
8
- ```sh
10
+ ```
9
11
  $ npm install --save tempfile
10
12
  ```
11
13
 
@@ -13,24 +15,33 @@ $ npm install --save tempfile
13
15
  ## Usage
14
16
 
15
17
  ```js
16
- var tempfile = require('tempfile');
18
+ const tempfile = require('tempfile');
17
19
 
18
20
  tempfile('.png');
19
- //=> /var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b.png
21
+ //=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4049f192-43e7-43b2-98d9-094e6760861b.png'
22
+
23
+ tempfile();
24
+ //=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/6271e235-13b9-4138-8b9b-ee2f26c09ce3'
20
25
  ```
21
26
 
22
27
 
23
28
  ## API
24
29
 
25
- ### tempfile(extension)
30
+ ### tempfile([extension])
26
31
 
27
32
  #### extension
28
33
 
29
34
  Type: `string`
30
35
 
31
- Optionally supply an extension to append to the path.
36
+ Extension to append to the path.
37
+
38
+
39
+ ## Related
40
+
41
+ - [tempy](https://github.com/sindresorhus/tempy) - Get a random temporary file or directory path
42
+ - [temp-write](https://github.com/sindresorhus/temp-write) - Write string/buffer/stream to a random temp file
32
43
 
33
44
 
34
45
  ## License
35
46
 
36
- MIT © [Sindre Sorhus](http://sindresorhus.com)
47
+ MIT © [Sindre Sorhus](https://sindresorhus.com)