-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample03Files.java
More file actions
24 lines (21 loc) · 886 Bytes
/
Example03Files.java
File metadata and controls
24 lines (21 loc) · 886 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import com.autonomi.antd.AntdClient;
import com.autonomi.antd.models.PutResult;
/**
* Example 03 — Upload and download files.
*/
public class Example03Files {
public static void main(String[] args) {
try (var client = new AntdClient()) {
// Upload a file
PutResult result = client.fileUploadPublic("/path/to/file.txt");
System.out.println("Uploaded to: " + result.address());
System.out.println("Cost: " + result.cost() + " atto");
// Download a file
client.fileDownloadPublic(result.address(), "/path/to/output.txt");
System.out.println("Downloaded successfully");
// Estimate cost before uploading
String cost = client.fileCost("/path/to/file.txt", true, false);
System.out.println("Estimated cost: " + cost + " atto");
}
}
}