All Projects → humphd → Nohost

humphd / Nohost

Licence: apache-2.0
A web server in your web browser

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Nohost

Filer
Node-like file system for browsers
Stars: ✭ 389 (+137.2%)
Mutual labels:  fs, filesystem, posix, browser
Fusell Seed
FUSE (the low-level interface) file system boilerplate 📂 🔌 💾
Stars: ✭ 9 (-94.51%)
Mutual labels:  filesystem, posix
Node Ntfs
Windows NT File System (NTFS) file system driver
Stars: ✭ 18 (-89.02%)
Mutual labels:  fs, filesystem
Browser Shell
A Linux command-line shell in the browser
Stars: ✭ 60 (-63.41%)
Mutual labels:  filesystem, browser
Electron Filesystem
FileSystem for windows
Stars: ✭ 409 (+149.39%)
Mutual labels:  fs, filesystem
Tinydir
Lightweight, portable and easy to integrate C directory and file reader
Stars: ✭ 575 (+250.61%)
Mutual labels:  filesystem, posix
Moosefs
MooseFS – Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System (Software-Defined Storage)
Stars: ✭ 1,025 (+525%)
Mutual labels:  filesystem, posix
Juicefs
JuiceFS is a distributed POSIX file system built on top of Redis and S3.
Stars: ✭ 4,262 (+2498.78%)
Mutual labels:  filesystem, posix
Zbox
Zero-details, privacy-focused in-app file system.
Stars: ✭ 1,185 (+622.56%)
Mutual labels:  fs, filesystem
Simple Fs
Handles files on indexeddb like you would do in node.js (promise)
Stars: ✭ 111 (-32.32%)
Mutual labels:  filesystem, browser
Flint
Fast and configurable filesystem (file and directory names) linter
Stars: ✭ 115 (-29.88%)
Mutual labels:  fs, filesystem
Filesystem
FileSystem is an application that allows you to browse the content of your iPhone disk, displaying file and folders, files contents, and detailed informations about file and folder permissions.
Stars: ✭ 148 (-9.76%)
Mutual labels:  filesystem, browser
Goofys
a high-performance, POSIX-ish Amazon S3 file system written in Go
Stars: ✭ 3,932 (+2297.56%)
Mutual labels:  filesystem, posix
Fdir
⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
Stars: ✭ 777 (+373.78%)
Mutual labels:  fs, filesystem
Chonky
😸 A File Browser component for React.
Stars: ✭ 313 (+90.85%)
Mutual labels:  fs, filesystem
Memfs
In-memory filesystem with Node's API
Stars: ✭ 854 (+420.73%)
Mutual labels:  fs, filesystem
Python Atomicwrites
Powerful Python library for atomic file writes.
Stars: ✭ 253 (+54.27%)
Mutual labels:  filesystem, posix
Tfs
Mirror of https://gitlab.redox-os.org/redox-os/tfs
Stars: ✭ 2,890 (+1662.2%)
Mutual labels:  fs, filesystem
Fast Glob
🚀 It's a very fast and efficient glob library for Node.js
Stars: ✭ 1,150 (+601.22%)
Mutual labels:  fs, filesystem
Litfs
A FUSE file system in Go extended with persistent file storage
Stars: ✭ 116 (-29.27%)
Mutual labels:  fs, filesystem

nohost

A web server in your web browser.

Overview

nohost uses Filer to run a node'js style, POSIX filesystem inside a Service Worker, and handle requests for static files and directories.

The most likely use case for nohost would be an app that uses Filer to run a filesystem in the window, and then use nohost to provide a way to interact with that filesystem in the browser via URLs, like one would with Apache or another web server hosting static files.

Example

NOTE: I don't currently have a full demo up (TODO), so the default filesystem is empty. My plan is to rework this into a module people can include along with Filer to allow self-hosting of static files in the browser.

Until then, here's what nohost looks like running with a fileystem manually created:

Example running

Clicking a link does what you'd expect, serving the file to the browser via the Service Worker.

Installation

To run it:

npm install
npm run build

The nohost Service Worker will be built in dist/nohost-sw.js. NOTE: you can also use npm run dev to also start a web server.

Now register nohost's Service Worker in your app at startup:

if(!('serviceWorker' in navigator)) {
  console.warn('unable to initialize nohost service worker: not supported.');
} else {
  navigator.serviceWorker
    .register('./nohost-sw.js') // see configuration options below
    .catch(err => {
      console.error(`unable to register nohost service worker: ${err.message}`);
    });
}

Configure Web Server

Various features of the nohost web server can be configured by passing options on the query string when registering the nohost-sw.js Service Worker:

  • route (String): with the route name to use when listening for filesystem path requests. Defaults to fs, such that /fs/path/to/file would respond with /path/to/file

  • disableIndexes (Boolean, present or absent): directory indexes (i.e., listings) will not be shown. By default they will be shown. If defined, users will have to know the filename they wish to get back from the server.

  • directoryIndex (String): overrides the default directory index filename, used when a directory path is given. Defautls to index.html. For example, /fs/ would return /fs/index.html by default (if present). If another name is specified here, that filename will be used instead.

For example:

// Use /www for the server route, and disable directory listings
navigator.serviceWorker
  .register('./nohost-sw.js?route=www&disableIndexes');

Browse Filesystem

After the Service Worker is installed, you can then browse into the filesystem via the specified route (defaults to /fs/*). For example, if running the demo: http://localhost:8080/fs/*, where /* is a path into the filesystem.

To get metadata about files/directories vs. contents, add ?json to the URL. For example: http://localhost:8080/fs/dir?json

To download instead of view files in the browser, add ?download or ?dl to the URL. For example: http://localhost:8080/fs/path/to/file.png?dl

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].