Socket
Socket
Sign inDemoInstall

github.com/fclairamb/afero-dropbox

Package Overview
Dependencies
4
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/fclairamb/afero-dropbox

Package dropbox provides an afero implementation to the dropbox API


Version published

Readme

Source

Dropbox Backend for Afero

Go version Build codecov Go Report Card GoDoc

About

It provides an afero filesystem implementation of a Dropbox backend.

This was created to provide a backend to the ftpserver but can definitely be used in any other code.

I'm very opened to any improvement through issues or pull-request that might lead to a better implementation or even better testing.

It is implemented on top of the Dropbox Go SDK.

Key points

  • Download & upload file streaming
  • Some coverage (all APIs are tested, but not all errors are reproduced)
  • Very carefully linted

Known limitations

  • File appending / seeking for write is not supported because dropbox doesn't support it
  • Chmod / Chtimes are not supported because dropbox doesn't support it

How to use

Note: Errors handling is skipped for brevity, but you definitely have to handle it.

package main

import(
	"os"
	
	dropbox "github.com/fclairamb/afero-dropbox"
)

func main() {
  // You access an FS with it's token
  fs := dropbox.NewFs(os.Getenv("DROPBOX_TOKEN"))
  
  // And do your thing
  file, _ := fs.OpenFile("file.txt", os.O_WRONLY, 0777)
  file.WriteString("Hello world !")
  file.Close()
}

FAQs

Last updated on 26 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc