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

Function createFileWriter

mediaapi/fileutils/fileutils.go:192–200  ·  view source on GitHub ↗

createFileWriter creates a buffered file writer with a new file The caller should flush the writer before closing the file. Returns the file handle as it needs to be closed when writing is complete

(directory types.Path)

Source from the content-addressed store, hash-verified

190// The caller should flush the writer before closing the file.
191// Returns the file handle as it needs to be closed when writing is complete
192func createFileWriter(directory types.Path) (*bufio.Writer, *os.File, error) {
193 filePath := filepath.Join(string(directory), "content")
194 file, err := os.Create(filePath)
195 if err != nil {
196 return nil, nil, fmt.Errorf("failed to create file: %w", err)
197 }
198
199 return bufio.NewWriter(file), file, nil
200}

Callers 1

createTempFileWriterFunction · 0.85

Calls 1

CreateMethod · 0.45

Tested by

no test coverage detected