NewSession creates a session with a unique temporary directory.
()
| 16 | |
| 17 | // NewSession creates a session with a unique temporary directory. |
| 18 | func NewSession() (*Session, error) { |
| 19 | dir, err := os.MkdirTemp("", "hbd-*") |
| 20 | if err != nil { |
| 21 | return nil, fmt.Errorf("create temp dir: %w", err) |
| 22 | } |
| 23 | return &Session{tempDir: dir}, nil |
| 24 | } |
| 25 | |
| 26 | // TempDir returns the session's temporary directory path. |
| 27 | func (s *Session) TempDir() string { |