# What changed in tempfile

> 8 changes in tempfile 2 to 3 from its official release notes, upgrade guides and advisories: 1 breaking, 1 deprecations, 2 new APIs and options. Each one cited. Sources checked 2026-11-30. HTML: https://unstale.sh/cargo/tempfile/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## tempfile 3

### Deprecations

- Deprecates TempPath::from_path in favor of the new TempPath::try_from_path method. (3.27.0) — [release notes](https://github.com/Stebalien/tempfile/blob/5c8fa12eb584931b4f1bccfde87eb72fbfa7dc61/CHANGELOG.md#3270)

### New APIs and options

- Adds a method that behaves like TempPath::from_path but returns an error if converting a relative path to an absolute path fails or the path is empty. (3.27.0) — [release notes](https://github.com/Stebalien/tempfile/blob/5c8fa12eb584931b4f1bccfde87eb72fbfa7dc61/CHANGELOG.md#3270)

### Behavior and default changes

- Now attempts to convert relative paths to absolute paths; if conversion fails, it keeps the relative path. (3.27.0) — [release notes](https://github.com/Stebalien/tempfile/blob/5c8fa12eb584931b4f1bccfde87eb72fbfa7dc61/CHANGELOG.md#3270)
- tempfile now supports getrandom 0.4.x while retaining support for getrandom 0.3.x, allowing projects to resolve either version. (3.25.0) — [release notes](https://github.com/Stebalien/tempfile/blob/5c8fa12eb584931b4f1bccfde87eb72fbfa7dc61/CHANGELOG.md#3250)
- WASIp2 is now fully supported without nightly features or additional feature flags. (3.24.0) — [release notes](https://github.com/Stebalien/tempfile/blob/5c8fa12eb584931b4f1bccfde87eb72fbfa7dc61/CHANGELOG.md#3240)

### Fixes and other changes

- NamedTempFile::persist is now supported on RedoxOS. (3.26.0) — [release notes](https://github.com/Stebalien/tempfile/blob/5c8fa12eb584931b4f1bccfde87eb72fbfa7dc61/CHANGELOG.md#3260)

## tempfile 2

### Breaking changes

- Replaces TempFile with a function that returns std::fs::File objects, which are more useful because most Rust libraries expect normal File objects. (2.0.0) — [release notes](https://github.com/Stebalien/tempfile/blob/HEAD/CHANGELOG.md)

### New APIs and options

- Adds a method to NamedTempFile to continue supporting shared temporary files. (2.0.0) — [release notes](https://github.com/Stebalien/tempfile/blob/HEAD/CHANGELOG.md)
