go>> jffs>> 返回
项目作者: mwat56

项目描述 :
An HTTP file-system that suppresses automatic directory listings
高级语言: Go
项目地址: git://github.com/mwat56/jffs.git
创建时间: 2019-10-14T12:55:55Z
项目社区:https://github.com/mwat56/jffs

开源协议:GNU General Public License v3.0

下载


jffs – Just Files Filesystem

golang
GoDoc
Go Report
Issues
Size
Tag
License


Purpose

Often you don’t want remote users to access your filesystem’s static files outside the URLs you provide with your web-application.
Especially if there are file(s) in your (sub-)directories which shouldn’t be served to others.
Therefore it’s imperative to hamper the Go fileserver insofar as to not produce directory listings showing all available files.
That’s were this small package comes in.

Credits go to Brad Fitzpatrick and Alex Edwards.

Installation

You can use Go to install this package for you:

  1. go get -u github.com/mwat56/jffs

Usage

This package exports a single function FileServer().
So, while you’re used to call

  1. myStaticDirectory :="/tmp"
  2. myStaticHandler := http.FileServer(http.Dir(myStaticDirectory)))

to use this implementation you’d now just use:

  1. myStaticHandler := jffs.FileServer(myStaticDirectory)

That’s all.

Licence

  1. Copyright © 2019, 2025 M.Watermann, 10247 Berlin, Germany
  2. All rights reserved
  3. EMail : <support@mwat.de>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the GNU General Public License along with this program. If not, see the GNU General Public License for details.


GFDL