Uses 9724K of libraries. Click here for Pure Java version (3439L/20K).
import net.schmizz.sshj.xfer.InMemorySourceFile; import net.schmizz.sshj.xfer.scp.SCPFileTransfer; // allow any host ID and search for pw in JavaX-Secret // doesn't do mkdirs svoid scpUpload(S user, S host, S remotePath, long length, InputStream in) ctex { final SSHClient client = sshLogin(user, host); try { SCPFileTransfer fileTransfer = client.newSCPFileTransfer(); fileTransfer.upload(new InMemorySourceFile { public S getName() { ret "dummy"; } public long getLength() { ret length; } public InputStream getInputStream() { ret in; } }, remotePath); } finally { sshDisconnect(client); } } svoid scpUpload(S user, S host, S remotePath, byte[] data) { scpUpload(user, host, remotePath, l(data), byteArrayInputStream(data)); }
Began life as a copy of #1004835
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009981 |
Snippet name: | scpUpload |
Eternal ID of this version: | #1009981/8 |
Text MD5: | 7dd15c816e4f3eadb540bb41efaccaaf |
Transpilation MD5: | 6cdd2c6ecc8a6a7e42d94aca377b0f49 |
Author: | stefan |
Category: | javax / networking |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-07-14 17:20:49 |
Source code size: | 795 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 430 / 524 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1009983 - scpUploadWithMkdirs #1009986 - scpUploadFile #1011874 - scpDownload |