Spaces:
Runtime error
Runtime error
| 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); | |
| }); |