“The art of programming is the skill of controlling complexity.” – Marijn Haverbeke
One day I needed to send some confidential file without signup. I googled about such service available on the internet and found file.io.
According to file.io website -
Simply upload a file, share the link, and after it is downloaded, the file is completely deleted. For added security, set an expiration on the file and it is deleted within a certain amount of time, even if it was never downloaded. All files are encrypted when stored on our servers.
Most of my time goes into hitting commands on the terminal. file.io can be accessed using any browser but I wanted to take this functionality to the terminal. I browsed that website and found an easy to use API.
At first, I tried to add a command for uploading files using an alias but it didn’t work very fine. Then I thought of writing function which will be foolproof and give some errors for helping out the user if they type something wrong.
Before going ahead make sure you have curl installed. If you are using Ubuntu, do this -
Add the functionality Automatically
Run this command in your terminal.
Add the functionality Manually
Add this to your ~/.bashrc or ~/.zsh file and restart your terminal. I tested this on bash and zsh in Ubuntu 18.04 LTS.
For simple file upload, do this
I am assuming here that the file name is file.ext.
You can also set an expiration period. By default, the expiration is set to 14 days. Pass 3rd argument for expiration. You can write any positive number followed by w, m or y. w is for weeks, m for months and y for years.
It is very useful when you have to send some small sensitive data to another person. You can be assured that the file you are sending to another person will be deleted after he/she download it. The only drawback is that you can’t send a large file(file_size < 100MB). Try this script on different shell out there and if you find any bug please let me know.