MCPcopy Create free account
hub / github.com/daodst/chat / createTempDir

Function createTempDir

mediaapi/fileutils/fileutils.go:177–187  ·  view source on GitHub ↗

createTempDir creates a tmp/ directory within baseDirectory and returns its path

(baseDirectory config.Path)

Source from the content-addressed store, hash-verified

175
176// createTempDir creates a tmp/<random string> directory within baseDirectory and returns its path
177func createTempDir(baseDirectory config.Path) (types.Path, error) {
178 baseTmpDir := filepath.Join(string(baseDirectory), "tmp")
179 if err := os.MkdirAll(baseTmpDir, 0770); err != nil {
180 return "", fmt.Errorf("failed to create base temp dir: %w", err)
181 }
182 tmpDir, err := os.MkdirTemp(baseTmpDir, "")
183 if err != nil {
184 return "", fmt.Errorf("failed to create temp dir: %w", err)
185 }
186 return types.Path(tmpDir), nil
187}
188
189// createFileWriter creates a buffered file writer with a new file
190// The caller should flush the writer before closing the file.

Callers 1

createTempFileWriterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected