Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/euantorano/tempdir.nim
A Nim library to create and manage temporary directories. Inspired by the Rust library of the same name: https://github.com/rust-lang-nursery/tempdir
https://github.com/euantorano/tempdir.nim
Last synced: about 8 hours ago
JSON representation
A Nim library to create and manage temporary directories. Inspired by the Rust library of the same name: https://github.com/rust-lang-nursery/tempdir
- Host: GitHub
- URL: https://github.com/euantorano/tempdir.nim
- Owner: euantorano
- License: bsd-3-clause
- Created: 2017-04-25T11:20:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-25T16:41:47.000Z (over 3 years ago)
- Last Synced: 2024-08-04T03:05:20.009Z (3 months ago)
- Language: Nim
- Homepage:
- Size: 14.6 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nim - tempdir - A Nim library to create and manage temporary directories. (Operating System / System API)
README
# tempdir
A Nim library to create and manage temporary directories. Inspired by [the Rust library of the same name](https://github.com/rust-lang-nursery/tempdir).
## Installation
```
nimble install tempdir
```Or add the following to your `.nimble` file:
```
# Dependenciesrequires "tempdir >= 1.0.1"
```## Usage
```nim
import tempdir# Create a new temporary directory in the system's temporary directory path, with directories having the prefix `test`.
withTempDirectory(tmp, "test"):
echo "Created temporary directory with path: ", tmp
# At the end of this block, the temporary directory and all of its files will be deleted# You can also create a temporary directory in a path of your choosing using the `createTempDirectory` procedure
let tmp2 = createTempDirectory("test", "./tmp")
echo "Created temporary directory with path: ", tmp2
```