fs

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 11 Imported by: 2

README

File system loading

On top of the supported file system and their associated config, they are few parameters that can be enabled.

Read-only

This blocks any writing call to the underlying file system. It can be abled by the read_only boolean parameter.

{
   "version": 1,
   "accesses": [
      {
         "read_only": true,
         
         // The usual FS config:
         "user": "test",
         "pass": "test",
         "fs": "os",
         "params": {
            "basePath": "/tmp"
         }
      }
   ]
}

Shared

This makes sure the underlying filesystem is loaded once per use. It can be enabled by the shared boolean parameter.

{
   "version": 1,
   "accesses": [
      {
         "shared": true,
        // The usual FS config:
        "user": "test",
         "pass": "test",
         "fs": "os",
         "params": {
            "basePath": "/tmp"
         }
      }
   ]
}

Sync & Delete

This creates a temporary local folder that will be replicated to a destination file system.

{
   "version": 1,
   "accesses": [
      {
        "sync_and_delete": {
            "enable": true,         // To enable it
            "directory": "/tmp/dir" // Temporary directory (optional)
         },
         // The usual FS config:
         "user": "test",
         "pass": "test",
         "fs": "os",
         "params": {
            "basePath": "/target"
         }
      }
   ]
}

Logging

{
   "version": 1,
   "accesses": [
      {
        "logging": {
            "file_accesses": true, // This logs every single file access
            "ftp_exchanges": true // This logs every single FTP command
        },
        // The usual FS config:
         "user": "test",
         "pass": "test",
         "fs": "os",
         "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 log.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
	// contains filtered or unexported fields
}

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 gdrive provides a Google Drive access layer
Package gdrive provides a Google Drive access layer
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

Jump to

Keyboard shortcuts

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