/storfiler

Get a file provider api in 30 seconds from configuration

Primary LanguageC#MIT LicenseMIT

storfiler

Get a file provider api in 30 seconds from configuration.

storfiler is a tiny API to list/download/update/delete files into server folders.

Installation

Download the last release, drop it to your server and that's it!

Configuration

All the configuration can be made in environment variable or appsettings.json file :

Host

Currently only chose to use IIS integration

"Host": {
  "UseIis": true
}

Kestrel

Kestrel options, see ms doc for usage

"Kestrel": {
  "AddServerHeader": false
}

Serilog

storfiler use Serilog for logging, see serilog-settings-configuration for usage

"Serilog": {
  "MinimumLevel": {
    "Default": "Debug",
    "Override": {
      "Microsoft": "Warning",
      "System": "Warning"
    }
  },
  "WriteTo": [
    { "Name": "Console" }
  ],
  "Enrich": ["FromLogContext"]
}

Storfiler

storfiler configuration

"Storfiler": [
  {
    "resource": "docs", // will be accessible at http://host/docs
    "DiskPaths": { // disk provider 
      "Read": ["C:\\documents"] // read multiple folders
    },
    "Methods": [ // declare methods & actions
      {
        "Verb": "Get",
        "Path": "/",
        "Action": "List" // list files
      }
  },
  {
    "Resource": "logs",
    "DiskPaths": {
      "Read": ["C:\\logs"],
      "Write": "C:\\logs"
    },
    "Methods": [
      {
        "Verb": "Get",
        "Path": "/",
        "Action": "List"
      },
      {
        "Verb": "Get",
        "Path": "/{fileName}",
        "Action": "Download" // Find & download one file
      },
      {
        "Verb": "Get",
        "Path": "/download",
        "Query": "path", // To use a path we must use query
        "Action": "Download",
        "IsFullPath": true // Specify if we use fullPath or read path
      },
      {
        "Verb": "Delete",
        "Path": "/{fileName}",
        "Action": "Remove" // remove one file
      },
      {
        "Verb": "Get",
        "Path": "/files/search/{fileName}",
        "Pattern": "{fileName}*",
        "Action": "Search" // search file in folder/subfolders with pattern
      }
    ]
  }
  ]