/FileBrowser

Small homemade AngularJS + Web API project

Primary LanguageC#

Table of Contents

  1. Routing
  2. Statistics
  3. API

image

Routing

image
Site uses AngularJS routing for file system browsing. It greatly simplifies integration with browser history functionality (back, forward, reload) and allows to keep track of current location in address bar. It also allows to save/copy direct link with current path. "Hashbang" is used to handle full Windows pathes with drive names.

Directory content is preloaded in route resolving stage to make sure directory is accessible and prevent navigation in case of failure.

Statistics

Statistics (file-by-size-range counting) takes a noticable amount of time and disk throughput for large folders with tens of thousands of files. Application tries to minimize this by cancelling unnecessary calculation in case of route change.

Calculation ignore folders inaccessible due to insufficient rights and files/folders with full name exceeding 255 character limit.

API

Browse

GET /browse/?path=<path>
Returns list of files and folders in the directory specified by path.

{
    "folders": {
        "name": "",
        "path": ""
    },
    "files": {
        "name": "",
        "path": ""
    }
}

Download

GET /download/?path=<path>
Downloads the file specified by path.

Statistics

GET /statistics/?path=<path>
Recursively calculates files by size ranges in directory specified by path.

{
    "<= 10MB": 0,
    "10MB - 50MB": 0,
    ">= 100MB": 0
}