Hashdrive
A replacement blockchain for one drive -> hashdrive😎,Simple CLI command tool to use ipfs storage
Created on 8th January 2023
•
Hashdrive
A replacement blockchain for one drive -> hashdrive😎,Simple CLI command tool to use ipfs storage
The problem Hashdrive solves
problem
Ipfs is awesome , but is it really required to open a web browser to upload files into filecoin.
what if there is only one command like
git push
git pull
to upload and get filesSolution 💡
Hashdrive solves the problem, we provide a CLI tool that user can download and use it anywhere , in any directory or filepath to upload the file just with one command ,
features📃
-t :- updating the web3.storage API token
-u :- upload file to web3.storage
-d :- download file
-ls :- list all file structures in present directory
-pwd :- returns the present working directory
-cd :- change directory
Challenges we ran into
File structures
We have decided to upload only files into the web3.storage , and store the file structure in a data file .This was required for
ls
,cd
andpwd
commands , where we have to traverse through the file structure, Due to this there were huge conflicts on the file storage and retrieval process.- A Data file to manage entire file structure , and the CIDs of all files was made using solidity smart contract , so that the CIDs are safe and can't be accessed by any attackers
commands with multiple arguments
since our solution is a CLI application , one of the major problem that we faced was the situation when user enter multiple commands and functionalities at once
- closely studied the commands that need to be mutually excllusive , and those that can be used together , and made the logical conditions to support all the possible and valid command inputs
Downloading the file
for downloading files from ipfs we just have a get function , as a result whenever we type the function we open a webbrowser , hence the file does not directly get download but opens a webpage , from which we have to download
- used
window.location
to downloiad the file directly without the browser
PowerShell says "execution of scripts is disabled on this system."
while installing package as a cli tool , powershell raised an error due to the insufficient permissions
- Running the following command solved the problem
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
here we have signed the execution policy for the existing user , thereby alowing node to install the cli tool
stack overflow link