#Introduction A simple file sharing program written in node
#Usage
- First run the server node server.js
- Now, the client has two modes
- Interactive mode: node client.js
- Bulk Uploader: node client.js <json_file>
#Dependencies
- 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
-
<NEWUSER>
-
<OLDUSER>
-
<SEARCH>
-
<UPLOAD>
-
<RESULTS>
-
<UPLOADED>
-
<REGISTERED>
#Limitations
- All p2p transferred files are written to a single file called recieved. Which is overwritten every time.