Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 12, 2020
1 parent 4ecbd80 commit 9f815c2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
16 changes: 11 additions & 5 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ declare namespace tempy {
type Options = MergeExclusive<
{
/**
_You usually won't need this option. Specify it only when actually needed._
File extension.
Mutually exclusive with the `name` option.
File extension. Mutually exclusive with the `name` option.
_You usually won't need this option. Specify it only when actually needed._
*/
readonly extension?: string;
},
{
/**
_You usually won't need this option. Specify it only when actually needed._
Filename.
Filename. Mutually exclusive with the `extension` option.
Mutually exclusive with the `extension` option.
_You usually won't need this option. Specify it only when actually needed._
*/
readonly name?: string;
}
Expand Down Expand Up @@ -58,7 +62,9 @@ declare const tempy: {
directory(): string;

/**
Get the root temporary directory path. For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`.
Get the root temporary directory path.
For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`.
*/
readonly root: string;
};
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
"description": "Get a random temporary file or directory path",
"license": "MIT",
"repository": "sindresorhus/tempy",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8.3"
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
Expand All @@ -31,17 +32,16 @@
"tmpdir",
"tmpfile",
"random",
"unique",
"uniq"
"unique"
],
"dependencies": {
"temp-dir": "^1.0.0",
"type-fest": "^0.3.1",
"unique-string": "^1.0.0"
"temp-dir": "^2.0.0",
"type-fest": "^0.10.0",
"unique-string": "^2.0.0"
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"tsd": "^0.11.0",
"xo": "^0.25.4"
}
}
22 changes: 4 additions & 18 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

> Get a random temporary file or directory path

## Install

```
$ npm install tempy
```


## Usage

```js
Expand All @@ -28,16 +26,15 @@ tempy.directory();
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/2f3d094aec2cb1b93bb0f4cffce5ebd6'
```


## API

### tempy.file([options])
### tempy.file(options?)

Get a temporary file path you can write to.

#### options

Type: `Object`
Type: `object`

*You usually won't need either the `extension` or `name` option. Specify them only when actually needed.*

Expand All @@ -61,19 +58,8 @@ Get a temporary directory path. The directory is created for you.

Get the root temporary directory path. For example: `/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T`


## FAQ

### Why doesn't it have a cleanup method?

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 [`rimraf`](https://github.com/isaacs/rimraf) for cleanup.


## Related

- [temp-write](https://github.com/sindresorhus/temp-write) - Write string/buffer/stream to a random temp file


## License
#### Why doesn't it have a cleanup method?

MIT © [Sindre Sorhus](https://sindresorhus.com)
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 comments on commit 9f815c2

Please sign in to comment.