Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bfontaine/vanish

:sparkles: Temporary files and directories made easy
https://github.com/bfontaine/vanish

go library temporary-files

Last synced: 22 days ago
JSON representation

:sparkles: Temporary files and directories made easy

Awesome Lists containing this project

README

        

# Vanish

**Vanish** is a minimal Go library to use temporary files and directories.

[![GoDoc](https://godoc.org/github.com/bfontaine/vanish?status.svg)](https://godoc.org/github.com/bfontaine/vanish/vanish)
[![Build Status](https://travis-ci.org/bfontaine/vanish.svg?branch=master)](https://travis-ci.org/bfontaine/vanish)

## Install

go get github.com/bfontaine/vanish/v2

## Usage

Vanish works with functions:

```go
package main

import "github.com/bfontaine/vanish/v2"

vanish.File(func(name string) {
// 'name' is a temporary file, use it here as you want, it’ll be deleted
// at the end of the function
})

vanish.Dir(func(name string) {
// here, 'name' is a directory
})

vanish.Env(func() {
// we can modify the environment here, it’ll be restored at the end of the
// function
})
```