Neverending Programming Mistakes
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


1.0.9 • Public • Published

Magic Window

This is a JavaScript tool that turns any folder on your computer into a pretty online file viewer (and editor in the future).

See live demo here (⌐■_■) — this is magic-window presenting itself → Hey!.

magic-window preview

If you need instructions on how to best set up your node environment, please look here. You only have to do this once.

Why is magic-window cool?

  • Built in the spirit of Open Source.
  • Need to share audio, books and video quickly with friends?
  • Need to easily show code to someone so that they can help you?
  • You will find other use cases when you start using it...


  • Share your code easily with anyone in the world.
  • Easy to install and use.
  • Beautiful design, responsive and retina-ready.
  • Syntax highlighting for 150+ computer languages.
  • Font ligatures via FiraCode font.
  • Instant file search.
  • Mount inside an existing express.js app so it can show its own source.
  • If the local port you're trying to use it on is taken, it will choose the first available one.


  • Breadcrumbs on file view.
  • Automatic reloading of source code on change.
  • Diff view of last change pushed to the client via
  • Ability to share just one file or some files from the folder.
  • Editing functionality with a view of passing tests / live css preview.


This utility is available on npm, so installation is a breeze. Use the -g flag:

npm install -g magic-window


To use it, cd into a directory, and run


Magic window (⌐■_■) is now running on localhost:3000 and ngrok url is produced for public sharing.


magic --help


Make the current folder available on <yourip>:3000 on the local network:


Copy ngrok url to clipboard:

magic --copy

Without public access:

magic --private

Make the current folder available on <yourip>:12345 on the local network:

magic --port 12345

If port you are trying to use is already used, magic-window will try the next available one.

Mount inside an existing express.js app to reveal its own source

npm install --save magic-window
app.use('/source', require('magic-window')('/source', { ignore: ['config'] }))

Then visit to see all the source code for easy presentation or discussion.

Known issues

  • When used as a mounted app and served with pm2 behind nginx (possibly Apache as well), there are issues because of incompatibility between config package and pm2. Use forever or Phusion Passenger instead in production.
  • There will be infinite recursion and stack overflow when trying to share a folder that has a symlink back to itself.


Files starting with a dot are assumed to be private and are not served.

Design and inspiration

Design is based on martinaglv/cute-files which is based on tutorialzine's file browser tutorial.


Project Home: NpmJs

Main Sponsor: Subcults

Main Author: davidhq

Add me on LinkedIn if you want to send pull requests and make magic-window better ¯(º_o)/¯


npm i magic-window

Downloadsweekly downloads








last publish


  • avatar
Report a vulnerability