notepilot / scripts /test-r2-upload.ts
jasonmdong's picture
Sync from GitHub via hub-sync
c057aea verified
Raw
History Blame Contribute Delete
499 Bytes
import "dotenv/config";
import {
uploadR2Artifact,
getR2ArtifactDownloadUrl,
} from "../src/lib/r2-artifacts";
async function main() {
const key = `test/hello-${Date.now()}.txt`;
await uploadR2Artifact({
key,
body: "Hello from Cloudflare R2!",
contentType: "text/plain",
});
const url = await getR2ArtifactDownloadUrl(key);
console.log("Uploaded:", key);
console.log("Temporary URL:", url);
}
main().catch((error) => {
console.error(error);
process.exit(1);
});