MCPcopy Create free account
hub / github.com/astercloud/aster / NewFile

Function NewFile

pkg/media/types.go:280–290  ·  view source on GitHub ↗

NewFile 创建文件

(source string)

Source from the content-addressed store, hash-verified

278
279// NewFile 创建文件
280func NewFile(source string) (*File, error) {
281 file := &File{}
282
283 if strings.HasPrefix(source, "http://") || strings.HasPrefix(source, "https://") {
284 file.URL = source
285 } else {
286 return NewFileFromPath(source)
287 }
288
289 return file, nil
290}
291
292// NewFileFromPath 从路径创建文件
293func NewFileFromPath(path string) (*File, error) {

Callers

nothing calls this directly

Calls 1

NewFileFromPathFunction · 0.85

Tested by

no test coverage detected