bfsftp

package module
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package bfsftp abstracts an FTP file system.

When imported, it registers a global `ftp://` scheme resolver and can be used like:

import (
  "github.com/bsm/bfs"

  _ "github.com/bsm/bfs/bfsftp"
)

func main() {
  ctx := context.Background()
  b, _ := bfs.Connect(ctx, "ftp://user:pass@hostname:21/path/to/root?tmpdir=%2Fcustom%2Ftmp")
  f, _ := b.Open(ctx, "file/within/root.txt")
  ...
}

bfs.Connect supports the following query parameters:

tmpdir - custom temp dir

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, address string, cfg *Config) (bfs.Bucket, error)

Connect initiates an bfs.Bucket backed by FTP.

func New

func New(address string, cfg *Config) (bfs.Bucket, error)

New initiates an bfs.Bucket backed by FTP.

Types

type Config

type Config struct {
	// Username to use.
	Username string
	// Password to use in combination with Username.
	Password string
	// An optional path prefix.
	Prefix string
	// A custom temp dir.
	TempDir string
}

Config is passed to New to configure the S3 connection.

Jump to

Keyboard shortcuts

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