NewLocal initializes a new local filesystem instance. NB! Make sure to call `Close()` after you are done working with it.
(dirPath string)
| 72 | // |
| 73 | // NB! Make sure to call `Close()` after you are done working with it. |
| 74 | func 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. |
| 93 | func (s *System) SetContext(ctx context.Context) { |
searching dependent graphs…