npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

magic-window

v1.0.10

Published

Turn any folder on your computer into a magic window

Downloads

3

Readme

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!.

** NOTICE **

ngrok was removed as a dependency for now, so this project only works on LAN or via forwarded external ports. Still useful but not (wan) p2p anymore for now... Ngrok was a temporary solution, wasn't secure enough and it currently doesn't compile on some Linux OS instances.

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...

Features:

  • 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.

Planned:

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

Installation

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

npm install -g magic-window

Usage

To use it, cd into a directory, and run

magic

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

Help

magic --help

Examples

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

magic

Don't copy ngrok url to clipboard:

magic --nocopy

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 http://example.com/source 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.

Notes

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.

Info

Project Home: NpmJs