17 lines
616 B
TypeScript
17 lines
616 B
TypeScript
import { loadR2Config, uploadToR2 } from "../src/index.js";
|
|
|
|
const dryRun = process.argv.includes("--dry-run");
|
|
|
|
console.log("=== R2 Upload - Test ===\n");
|
|
|
|
if (dryRun) {
|
|
console.log("(dry-run) Config check skipped");
|
|
console.log(JSON.stringify({ status: "success", mode: "dry_run" }, null, 2));
|
|
} else {
|
|
const config = loadR2Config();
|
|
const testContent = `R2 upload test at ${new Date().toISOString()}`;
|
|
const key = `test/r2-upload-skill-test-${Date.now()}.txt`;
|
|
const url = await uploadToR2(config, key, testContent, "text/plain");
|
|
console.log(JSON.stringify({ status: "success", url }, null, 2));
|
|
}
|