TempDir
Overview
TempDir returns the default temp directory.
If you are coming from Node.js, the closest pattern is os.tmpdir().
Signature
go
func TempDir() stringCompare: Node.js · Standard Go · gox
js
os.tmpdir()go
val, err := os.TempDir()go
import "github.com/sahilkhaire/gox/osutil"
osutil.TempDir()Example
go
import "github.com/sahilkhaire/gox/osutil"
osutil.TempDir()Tips
Import github.com/sahilkhaire/gox/osutil and call TempDir directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
val, err := os.TempDir()