Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tempy

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tempy - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

16

index.d.ts

@@ -7,5 +7,7 @@ import {MergeExclusive} from 'type-fest';

/**
File extension.
Mutually exclusive with the `name` option.
_You usually won't need this option. Specify it only when actually needed._
File extension. Mutually exclusive with the `name` option.
*/

@@ -16,5 +18,7 @@ readonly extension?: string;

/**
Filename.
Mutually exclusive with the `extension` option.
_You usually won't need this option. Specify it only when actually needed._
Filename. Mutually exclusive with the `extension` option.
*/

@@ -63,3 +67,5 @@ readonly name?: 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`.
*/

@@ -66,0 +72,0 @@ readonly root: string;

@@ -11,3 +11,2 @@ 'use strict';

options = {
extension: '',
...options

@@ -17,3 +16,3 @@ };

if (options.name) {
if (options.extension) {
if (options.extension !== undefined && options.extension !== null) {
throw new Error('The `name` and `extension` options are mutually exclusive');

@@ -25,3 +24,3 @@ }

return getPath() + '.' + options.extension.replace(/^\./, '');
return getPath() + (options.extension === undefined || options.extension === null ? '' : '.' + options.extension.replace(/^\./, ''));
};

@@ -28,0 +27,0 @@

{
"name": "tempy",
"version": "0.3.0",
"version": "0.4.0",
"description": "Get a random temporary file or directory path",
"license": "MIT",
"repository": "sindresorhus/tempy",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {

@@ -13,3 +14,3 @@ "name": "Sindre Sorhus",

"engines": {
"node": ">=8"
"node": ">=10"
},

@@ -35,15 +36,14 @@ "scripts": {

"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"
}
}

@@ -5,3 +5,2 @@ # tempy [![Build Status](https://travis-ci.org/sindresorhus/tempy.svg?branch=master)](https://travis-ci.org/sindresorhus/tempy)

## Install

@@ -13,3 +12,2 @@

## Usage

@@ -33,6 +31,5 @@

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

@@ -43,3 +40,3 @@ Get a temporary file path you can write to.

Type: `Object`
Type: `object`

@@ -68,17 +65,6 @@ *You usually won't need either the `extension` or `name` option. Specify them only when actually needed.*

## FAQ
### Why doesn't it have a cleanup method?
#### Why doesn't it have a cleanup method?
The operating system will clean up when needed. No point in us wasting resources and adding complexity.
## Related
- [temp-write](https://github.com/sindresorhus/temp-write) - Write string/buffer/stream to a random temp file
## License
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.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc