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 := config.NewContextInMemory() 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 ¶
View Source
var ErrNotInit = fmt.Errorf("not initialized")
ErrNotInit is returned when the file is not initialized.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.