MCPcopy Create free account
hub / github.com/gotenberg/gotenberg / readFile

Method readFile

pkg/modules/api/formdata.go:673–686  ·  view source on GitHub ↗

readFile binds the content of a file to a string variable. It populates an error if it fails to read the file content.

(path, filename string, target *string)

Source from the content-addressed store, hash-verified

671// readFile binds the content of a file to a string variable. It populates an
672// error if it fails to read the file content.
673func (form *FormData) readFile(path, filename string, target *string) *FormData {
674 b, err := os.ReadFile(path)
675 if err != nil {
676 form.append(
677 fmt.Errorf("form file '%s' is invalid (%w)", filename, err),
678 )
679
680 return form
681 }
682
683 *target = string(b)
684
685 return form
686}

Callers 2

ContentMethod · 0.95
MandatoryContentMethod · 0.95

Calls 1

appendMethod · 0.95

Tested by

no test coverage detected