Transit.sh

Direct file transfer with your terminal. No subscription, no storage, no additional tool needed.

You can use curl (with limitations) or my python one-liner.

Using cURL

curl is available on most systems but is not suited for large files.
Because of this service's provider HTTP transfers have limitations. 100MiB maximum.

# Send
curl -T <file> https://transit.sh/<some-string>/
# Receive
curl -JLO https://transit.sh/<some-string>/
# Example
curl -T /music/song.mp3 https://transit.sh/music-for-dad/
curl -JLO https://transit.sh/music-for-dad/

Using Python

This python one-liner uses websockets and doesn't have any limitations.
The script will install the websockets package then ask for your file and identifier.
Just paste the following in your terminal:

# Send
python -c 'exec("""\nimport subprocess\nsubprocess.run(["pip", "install", "-q", "websockets"], check=False)\n\nimport json\nimport asyncio\nimport mimetypes\nimport websockets\nfrom pathlib import Path\n\ndef ask_for_path():\n    while True:\n        path = Path(input("\\nFile path (you can drag-and-drop): ")).resolve()\n        if path.exists() and path.is_file():\n            break\n        print(f"{path} is not a valid file.")\n    return path\n\ndef ask_for_identifier():\n    while True:\n        identifier = input("Transfer ID: ")\n        if identifier:\n            return identifier\n\nasync def send():\n    file_path = ask_for_path()\n    identifier = ask_for_identifier()\n\n    async with websockets.connect(f"wss://transit.sh/send/{identifier}") as websocket:\n        file = Path(file_path).resolve()\n        file_name, file_size, file_type = file.name, file.stat().st_size, mimetypes.guess_type(file.name, strict=False)[0]\n        header = json.dumps({"file_name": file_name, "file_size": file_size, "file_type": file_type})\n        await websocket.send(header)\n\n        print("Waiting for other peer to connect...")\n        while (msg := await websocket.recv()) != "Go for file chunks":\n            print(f"Unexpected message: {msg}")\n    \n        print("Peer connected. Starting transfer.")\n        with file.open("rb") as fd:\n            bytes_read = 0\n            while chunk := fd.read(2**15):\n                await websocket.send(chunk)\n                bytes_read += len(chunk)\n                print(f"Transfering... {bytes_read/file_size*100:.2f}%", end="\\r", flush=True)\n        await websocket.send(str().encode())\n        print("\\nDone.")\n\nasyncio.run(send())\n""")'
# Receive
python -c 'exec("""\nimport subprocess\nsubprocess.run(["pip", "install", "-q", "websockets"], check=False)\n\nimport json\nimport asyncio\nfrom pathlib import Path\nfrom websockets import connect\n\ndef ask_for_path():\n    while True:\n        path = Path(input("\\nDest. directory: ")).resolve()\n        if path.exists() and path.is_dir():\n            break\n        print(f"{path} is not a valid directory.")\n    return path\n\ndef ask_for_identifier():\n    while True:\n        identifier = input("Transfer ID: ")\n        if identifier:\n            return identifier\n\nasync def receive():\n    path = ask_for_path()\n    identifier = ask_for_identifier()\n\n    async with connect(f"wss://transit.sh/receive/{identifier}") as websocket:\n        response = await websocket.recv()\n        if response == "File not found":\n            print(f"No transfer with ID {identifier} found.")\n            return\n\n        header = json.loads(response)\n        file_name, file_size, file_type = header["file_name"], header["file_size"], header["file_type"]\n        print(f"File: {file_name} - Size: {file_size / 1024**2:.2f}MB\\nSaving to: {path / file_name}")\n\n        with open(path / file_name, "wb") as fd:\n            await websocket.send("Go for file chunks")\n            bytes_received = 0\n            while (chunk := await websocket.recv()) != b"":\n                fd.write(chunk)\n                bytes_received += len(chunk)\n                print(f"Receiving... {bytes_received/file_size*100:.2f}%", end="\\r", flush=True)\n\n        print("\\nTransfer complete.")\n\nasyncio.run(receive())\n""")'

The received file will be saved in the same directory the script was executed.

Information