MCPcopy
hub / github.com/pocketbase/pocketbase / NewLocal

Function NewLocal

tools/filesystem/filesystem.go:74–90  ·  view source on GitHub ↗

NewLocal initializes a new local filesystem instance. NB! Make sure to call `Close()` after you are done working with it.

(dirPath string)

Source from the content-addressed store, hash-verified

72//
73// NB! Make sure to call `Close()` after you are done working with it.
74func NewLocal(dirPath string) (*System, error) {
75 ctx := context.Background() // default context
76
77 // makes sure that the directory exist
78 if err := os.MkdirAll(dirPath, os.ModePerm); err != nil {
79 return nil, err
80 }
81
82 drv, err := fileblob.New(dirPath, &fileblob.Options{
83 NoTempDir: true,
84 })
85 if err != nil {
86 return nil, err
87 }
88
89 return &System{ctx: ctx, bucket: blob.NewBucket(drv)}, nil
90}
91
92// SetContext assigns the specified context to the current filesystem.
93func (s *System) SetContext(ctx context.Context) {

Calls 2

NewFunction · 0.92
NewBucketFunction · 0.92

Used in the wild real call sites across dependent graphs

searching dependent graphs…