2021年12月4日 星期六

Copy small file trick between terminal A and B

有時兩個 Terminal 之間無法直接連線或透過第三方交換檔案,甚至無網路的的話,可以透過此技巧交換檔案

檔案是 foo.zip
在 Terminal A 把檔案壓縮再 base64 編碼
gzip -c foo.zip | base64

把 base64 code 貼到 Terminal B 的一個檔 foo.b64,然後再 base64 decode,解壓後輸出
base64 -d foo.b64 | gunzip > foo.zip

適合比較小的檔案,base 64 編碼沒有超過一頁,較好複製

沒有留言:

Download test of any file size

1GB 以內任意大小測試檔案下載服務 1MB ~ 1024MB (1GB) 檔案內容是隨機產生的,某些測試情境可能會有用處 https://pank.org/testfile/1mb.bin 檔名可以是 1mb.bin 到 1024mb.bin,後面的 mb.bin 是固定的