Documentation
¶
Overview ¶
Package tempfile is a wrapper around os.MkdirTemp, providing an OO pattern as well as secure placement on a temporary ramdisk.
Example ¶
ctx := context.Background()
tempfile, err := New(ctx, "gopass-secure-")
if err != nil {
panic(err)
}
defer func() {
if err := tempfile.Remove(ctx); err != nil {
panic(err)
}
}()
fmt.Fprintln(tempfile, "foobar")
if err := tempfile.Close(); err != nil {
panic(err)
}
out, err := os.ReadFile(tempfile.Name())
if err != nil {
panic(err)
}
fmt.Println(string(out))
Output: foobar
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.