HFS: HTTP File Server
raw JSON →HFS (HTTP File Server) is a file-sharing server that turns your computer into a file-sharing hub with unlimited space and bandwidth. Current stable version is 3.1.1 (December 2024), with active development and frequent releases (multiple minor versions per year). Key differentiators include a virtual file system, instant ZIP downloads for large folders, real-time activity monitoring, bandwidth throttling, and a plugin system. It supports HTTPS, WebDAV (since 3.1.0), IPv6, and runs on Windows, Linux, macOS, FreeBSD, and Android. Compared to alternatives like FileZilla or Samba, HFS is lightweight, zero-configuration, and designed for temporary or permanent file sharing over HTTP/HTTPS with a web-based admin interface. It requires Node.js >=18.15.0 and is available as a binary or via npx.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/hfs/index.js from /path/to/your/file.js not supported ↓
error TypeError: hfs.start is not a function ↓
error Error: listen EADDRINUSE :::8080 ↓
Warnings
breaking HFS v3 requires Node.js >= 18.15.0 ↓
breaking HFS v3 is ESM-only; CommonJS require() will throw an error ↓
deprecated The 'vfs' option in config is deprecated in favor of 'virtualFileSystem' ↓
gotcha Admin panel does not require a password for localhost by default (localhost_admin defaults to true) ↓
gotcha Windows antivirus may flag the HFS binary as a false positive ↓
Install
npm install hfs yarn add hfs pnpm add hfs Imports
- start wrong
const hfs = require('hfs'); hfs.start()correctimport { start } from 'hfs' - Hfs wrong
import Hfs from 'hfs'correctimport { Hfs } from 'hfs' - Config wrong
const Config = require('hfs').Configcorrectimport { Config } from 'hfs'
Quickstart
import { start } from 'hfs';
const config = {
port: 8080,
host: '0.0.0.0',
root: './shared',
admin: {
password: process.env.HFS_ADMIN_PASSWORD ?? 'temp123'
}
};
const server = await start(config);
console.log('HFS server running on http://localhost:' + config.port);
// To stop: await server.close();