Introduction | temporary-directory-rust | Spatie       

 SPATIE  

temporary-directory-rust
========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Temporary-directory-rust](https://spatie.be/docs/temporary-directory-rust/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/temporary-directory-rust/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/temporary-directory-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/temporary-directory-rust/v1/support-us)
- [ Installation ](https://spatie.be/docs/temporary-directory-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/temporary-directory-rust/v1/usage)
- [ Testing ](https://spatie.be/docs/temporary-directory-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/temporary-directory-rust/v1/changelog)
- [ PHP and Rust API ](https://spatie.be/docs/temporary-directory-rust/v1/parity)

  Temporary-directory-rust 
==========================

 Create, use and delete temporary directories in Rust 

### Useful links

- [Repository](https://github.com/spatie/temporary-directory-rust)
- [Discussions](https://github.com/spatie/temporary-directory-rust/discussions)

Introduction
------------

This package allows you to quickly create, use and delete a temporary directory in the system's temporary directory.

Here's a quick example on how to create a temporary directory and delete it:

```
use spatie_temporary_directory::TemporaryDirectory;

let temporary_directory = TemporaryDirectory::new().create()?;

// Get a path inside the temporary directory
temporary_directory.path_for("temporaryfile.txt")?;

// Delete the temporary directory and all the files inside it
temporary_directory.delete()?;
```

You can also have the directory [deleted automatically](usage#deleting-a-temporary-directory-when-the-object-is-destroyed) when the object goes out of scope. Automatic cleanup is off by default.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
