fix: 内置 dartssh2 2.11.0 补丁版(third_party 本地依赖),修复新版 Dart SDK 下 sftp_client 编译错误
This commit is contained in:
1 parent
6daa9dd361
commit
0a33fabec2
139 files changed
+16497
-1
No files matched your search
+27
@@ -0,0 +1,27 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dartssh2/dartssh2.dart';
|
||||
|
||||
void main(List<String> args) async {
|
||||
final client = SSHClient(
|
||||
await SSHSocket.connect('localhost', 22),
|
||||
username: 'root',
|
||||
onPasswordRequest: () {
|
||||
stdout.write('Password: ');
|
||||
stdin.echoMode = false;
|
||||
return stdin.readLineSync() ?? exit(1);
|
||||
},
|
||||
);
|
||||
|
||||
final sftp = await client.sftp();
|
||||
final file = await sftp.open(
|
||||
'file.txt',
|
||||
mode: SftpFileOpenMode.truncate | SftpFileOpenMode.write,
|
||||
);
|
||||
|
||||
await file.write(File('local_file.txt').openRead().cast()).done;
|
||||
print('done');
|
||||
|
||||
client.close();
|
||||
await client.done;
|
||||
}
|
||||
Reference in new issue
Block a user