drivefs

package module
v0.0.0-...-9595394 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 9 Imported by: 1

README

drivefs

drivefs allows you to serve static files in your Go application from Google Drive using the familiar http.FileSystem interface.

Go Report Card Documentation

Usage

import (
    "log"
    "net/http"

    "google.golang.org/api/drive/v3"
    "github.com/squat/drivefs"
)

func main() {
    ...
    driveService, err := drive.New(oauthHttpClient)
    // Handle error.
    if err != nil {
        log.Fatal(err)
    }
    fs := drivefs.New(driveService)
    // Simple static webserver:
    log.Fatal(http.ListenAndServe(":8080", http.FileServer(fs)))
}

Documentation

Overview

Package drivefs allows Google Drive to be used as a static file server by implementing the http.FileSystem interface.

Usage example:

import (
    "log"
    "net/http"

    "google.golang.org/api/drive/v3"
    "github.com/squat/drivefs"
)

func main() {
    ...
    driveService, err := drive.New(oauthHttpClient)
    // Handle error.
    if err != nil {
        log.Fatal(err)
    }
    fs := drivefs.New(driveService)
    // Simple static webserver:
    log.Fatal(http.ListenAndServe(":8080", http.FileServer(fs)))
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(service *drive.Service) http.FileSystem

New creates a new http.FileSystem backed by Google Drive.

Types

This section is empty.

Jump to

Keyboard shortcuts

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