fs

package
v0.16.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 14 Imported by: 2

README

Common access options

On top of the backend (fs) and its params, every access supports a few options.

Read-only

The read_only boolean blocks any write to the underlying file system.

{
  "user": "test",
  "pass": "test",
  "fs": "os",
  "read_only": true,
  "params": {
    "basePath": "/tmp"
  }
}

Shared

The shared boolean makes the backend instance created at the first login of the user reused by all their later sessions, instead of creating a new one for each session. This is useful for backends with an expensive setup (SFTP connection, Telegram bot...). Shared instances are dropped when the configuration is reloaded.

{
  "user": "test",
  "pass": "test",
  "fs": "os",
  "shared": true,
  "params": {
    "basePath": "/tmp"
  }
}

Sync & Delete

The sync_and_delete option makes uploaded files written to a local temporary directory first, and then moved to the backend once they are complete (see afero-snd). The directory is optional, a system temporary directory is used when it isn't specified.

{
  "user": "test",
  "pass": "test",
  "fs": "os",
  "sync_and_delete": {
    "enable": true,
    "directory": "/tmp/snd"
  },
  "params": {
    "basePath": "/target"
  }
}

Logging

The logging option enables the logging of the FTP exchanges and/or the file accesses of this access only. The same options exist at the server level to enable them for all the accesses.

{
  "user": "test",
  "pass": "test",
  "fs": "os",
  "logging": {
    "ftp_exchanges": true,
    "file_accesses": true
  },
  "params": {
    "basePath": "/target"
  }
}

Documentation

Overview

Package fs provides all the core features related to file-system access

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFs

func LoadFs(access *confpar.Access, logger *slog.Logger) (afero.Fs, error)

LoadFs loads a file system from an access description

Types

type UnsupportedFsError added in v0.8.0

type UnsupportedFsError struct {
	Type string
}

UnsupportedFsError is returned when the described file system is not supported

func (UnsupportedFsError) Error added in v0.8.0

func (err UnsupportedFsError) Error() string

Directories

Path Synopsis
Package afos provide an afero OS FS access layer
Package afos provide an afero OS FS access layer
Package dropbox provides a Dropbox layer
Package dropbox provides a Dropbox layer
Package fslog provides an afero FS logging package
Package fslog provides an afero FS logging package
Package gcs provides a Google Cloud Storage access layer
Package gcs provides a Google Cloud Storage access layer
Package gdrive provides a Google Drive access layer
Package gdrive provides a Google Drive access layer
Package keycloak provides a local file system access layer whose users are authenticated by Keycloak
Package keycloak provides a local file system access layer whose users are authenticated by Keycloak
Package mail provides a mail access layer
Package mail provides a mail access layer
Package s3 provides an AWS S3 access layer
Package s3 provides an AWS S3 access layer
Package sftp provides an SFTP connection layer
Package sftp provides an SFTP connection layer
Package stripprefix is a file-system abstraction layer to strip a part of the path
Package stripprefix is a file-system abstraction layer to strip a part of the path
Package telegram provides a telegram access layer
Package telegram provides a telegram access layer
Package utils provides helpers shared by the file systems
Package utils provides helpers shared by the file systems

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL