Socket
Book a DemoInstallSign in
Socket

github.com/dh1tw/nolistfs

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/dh1tw/nolistfs

Source
Go
Version
v0.1.1
Version published
Created
Source

Go Reference

TL;DR

NoListFileSystem is a custom filesystem implementation. It wraps around a "base" file system. It is mainly used with http.FileServer so that 404 status code is returned instead of a directory listing.

Instead of copy & pasting this code in all of my projects, I prefer to store it in a dedicated package.

Example

Please check the example folder for a basic example which:

  • uses go embed to embed all static assets
  • shows how to use NoListFileSystem
  • runs an HTTP server to demonstrate the behaviour

$ go run example/main.go
Listening on 127.0.0.1:7474

When the webserver is started, head to static and a 404 Error will be returned, instead of a directory listing.

Credits

FAQs

Package last updated on 07 Nov 2021

Did you know?

Socket

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