Local area network file sharing
A simple way to share files across a local area network
|
view on
github
|
lan.js
is simple a Javascript file which runs under node.js which runs a local server that's accessible through private network and loopback IPs. A directory is specified to the application, and it will serves the files in the directory over HTTP.
It's also useful for testing webpages which may be required to not be a file:
URI to work.
node.exe
executables, lan.js
, run.bat
, and a files
folderIf you're using Windows, select the “Package” download above and unzip it to a folder. You can place files inside the included “files” folder and they will be easily served.
To start the server: double-click run.bat
To close: close the command window, or CTRL+C
inside of it if you like
To access the server while it is running, go to one of the following urls: assuming the server is using port 80
Network addresses will be listed on lan.js
startup. Pick any address not labeled “external” to use for connecting.
If you're using another operating system, reading the contents of run.bat
and porting it to a different shell language should be fairly simple.
The following are the basic editable settings that appear in run.bat
. They can be changed if desired or required.
node.exe
”; if you have an x86 and an x64 version of node.js installed, the batch script will choose the most appropriate version for your operating system: x64 for a 64-bit system, and fallback to x86 for a 32-bit system.EADDRINUSE
.lan.js
script appears in, an error is issued. To ignore this error, the --allow-parent-directories
flag must appear on the command line.