MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / NewStreamFile

Function NewStreamFile

message/elements.go:322–331  ·  view source on GitHub ↗
(r io.ReadSeeker, fileName string)

Source from the content-addressed store, hash-verified

320}
321
322func NewStreamFile(r io.ReadSeeker, fileName string) *FileElement {
323 md5, sha1, length := crypto.ComputeMd5AndSha1AndLength(r)
324 return &FileElement{
325 FileName: fileName,
326 FileSize: length,
327 FileStream: r,
328 FileMd5: md5,
329 FileSha1: sha1,
330 }
331}
332
333func NewLocalFile(path string, name ...string) (*FileElement, error) {
334 file, err := os.Open(path)

Callers 2

NewFileFunction · 0.85
NewLocalFileFunction · 0.85

Calls 1

Tested by

no test coverage detected