P2P filesharing
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


#Introduction A simple file sharing program written in node


  1. First run the server node server.js
  2. Now, the client has two modes
  • Interactive mode: node client.js
  • Bulk Uploader: node client.js <json_file>


  • Node
  • sqlite3

#Design Decisions

  • Multiple Clients: Nodejs has been specifically used because of this reason, since nodejs handles everything asynchronously in an event loop, it has the ideal environment for a network application.

  • Multiple Requests: Each connection to the server serves as a closure; in essence, every connection is handled independent of other clients. Each request is handled inside this connection object.

  • Database: sqlite has been used for the database as it does not need additional installations and only requires a node module. A simple file can serve as a sqlite database.

  • Filepath: Filepaths are resolved before sending them to the server, invalid paths are signalled as an error.

  • P2P: Every client has a listener at FILEPORT, whenever it recieves a request to share a file, it sends the entire file to peer asking for it.

  • Command Structure: <COMMAND>;;parameter1;;parameter2..

  • ;; has been chosen as the delimiter arbitarily



  • <SEARCH>

  • <UPLOAD>





  • All p2p transferred files are written to a single file called recieved. Which is overwritten every time.