0.1.1 • Published 9 months ago

utcli v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Logo UTCLI - An unofficial uploadthing cli tool

About

This project aims to broaden the uses for uploadthing, by exposing it's REST API through a cli tool. It can be used to upload, list, and delete files inside your uploadthing project. It's primary use case is for creating a rolling CDN, which you can read more about below.

Commands

CommandOptionsPurposeExample
Upload<files...> --manifest <path>Uploads files to the project in parallel, optionally recording the uploads to a manifestnpx utcli upload image.png image.jpeg --manifest manifest.json
List--offset <count> --limit <count>Lists all files currently in the projectnpx utcli list --offset 20 --limit 10
Delete<keys...>Deletes all the files specified as keysnpx utcli delete a0sDw0d2hE4eIgpIHPNbTjxrwPKzsCt9f5Y7J4yOW2XE1ac0 a0sDw0d2hE4em8aeirVWPf5d0MJIz67eyki9jEYp2XCFHqrB
Clean--confirm --keep-manifest <path>Deletes every file in the project, except those included in the keep-manifestnpx utcli clean --keep-manifest manifest.json --confirm

Authentication

Running any commands that interface with the uploadthing API will fail if an UPLOADTHING_TOKEN isn't available in your environment. To make it available, run export UPLOADTHING_TOKEN=<...>, or add it to you application CI/CD.

Rolling CDN Pattern

With UTCLI, you can easily setup what I call a 'rolling CDN'. As part of your application's build step, run npx utcli upload <static files> --manifest manifest.json. This uploads all of your static files to your uploadthing project. Your application can then link to them, or serve redirects to them, using the manifest file. Finally, to make the system 'rolling', we need to delete the static files from the last build. This can be done using npx utcli clean --keep-manifest manifest.json --confirm.

0.1.1

9 months ago

0.1.0

9 months ago

0.0.0

9 months ago