Skip to content
Node: os.tmpdir()github.com/sahilkhaire/gox/osutil

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() string

Compare: 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()

Back to osutil package overview

MIT Licensed · Built for Node.js developers moving to Go