Socket
Book a DemoInstallSign in
Socket

@jun-a/local-filebrowser

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jun-a/local-filebrowser

Simple file browser web application built with Express.js

2.0.1
latest
npmnpm
Version published
Maintainers
1
Created
Source

@jun-a/local-filebrowser

Simple local file browser web application with CLI support. Browse your files and preview content in a web interface.

Installation

npm install -g @jun-a/local-filebrowser

Local Installation

npm install @jun-a/local-filebrowser

Usage

CLI Commands

After global installation, you can use either command:

Short command (lfb):

# Start file browser on default port (3099)
lfb

# Start on specific port
lfb -p 8080

# Browse specific directory
lfb -d ~/Documents

# Combine options
lfb -p 8080 -d ~/Downloads

Full command (local-file-browser):

# Start file browser on default port (3099)
local-file-browser

# Start on specific port
local-file-browser -p 8080

# Browse specific directory
local-file-browser -d ~/Documents

# Combine options
local-file-browser -p 8080 -d ~/Downloads

CLI Options

  • -p, --port <number>: Port number (default: 3099)
  • -d, --path <path>: Directory path to browse (default: current directory)
  • -h, --help: Show help message
  • -v, --version: Show version number

Programmatic Usage

const path = require('path');
const { spawn } = require('child_process');

// Set environment variables
process.env.PORT = '8080';
process.env.DATA_PATH = path.resolve('./my-directory');

// Start server
require('@jun-a/local-filebrowser');

Manual Installation

git clone <repository-url>
cd local-filebrowser
npm install
npm start

Features

  • Directory browsing: View files and folders in any directory
  • File preview: Support for multiple file types
    • Markdown (.md): Rendered HTML display
    • Code files (.js, .css, .html, .py, .java, .cpp, etc.): Syntax highlighting
    • Text files (.txt): Plain text display
    • Images (.png, .jpg, .gif, etc.): Image display
  • Breadcrumb navigation: Easy navigation through directory hierarchy
  • Responsive design: Mobile-friendly interface
  • Security: Path traversal protection and file size limits

Environment Variables

  • PORT: Server port (default: 3099)
  • DATA_PATH: Base directory path (default: current working directory)

Web Interface

  • Open your browser and go to http://localhost:3099 (or your specified port)
  • Enter a directory path in the input field
  • Click "Browse" or press Enter
  • Click on files to preview them
  • Click on folders to navigate into them

API Endpoints

GET /api/browse

  • Parameter: path (directory path)
  • Response: List of files and folders

GET /api/preview

  • Parameter: path (file path)
  • Response: File content and type information

GET /api/file

  • Parameter: path (file path)
  • Response: Raw file data

Security Features

  • File size limit (1MB for preview)
  • Path traversal protection
  • Proper MIME type handling
  • Error handling and validation

Technology Stack

  • Frontend: HTML5, CSS3, JavaScript (ES6+)
  • Backend: Node.js, Express.js
  • Markdown processing: marked.js
  • Syntax highlighting: highlight.js
  • MIME type handling: mime-types

File Structure

@jun-a/local-filebrowser/
├── bin/
│   └── lfb.js           # CLI executable
├── public/
│   ├── css/
│   │   └── styles.css
│   └── js/
│       └── app.js
├── views/
│   └── index.html
├── server.js            # Main server file
├── package.json
└── README.md

Contributing

  • Fork the repository
  • Create a feature branch
  • Make your changes
  • Add tests if applicable
  • Submit a pull request

License

ISC License

Changelog

v1.0.0

  • Initial release
  • CLI support with lfb command
  • File browsing and preview functionality
  • Responsive web interface

Keywords

file-browser

FAQs

Package last updated on 31 Aug 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.