preserve

command module
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

README

Go Report Card

Luzifer / preserve

preserve is a little HTTP server to preserve the presence of URLs.

Ever relied on an HTTP resource to be available and it vanished? Happened too often to me so I wrote a little tool to prevent URLs from vanishing: preserve.

Usage

After you've started preserve it will by default listen on port 3000 and you can start using it by prefixing the URL of the resource:

Lets say you want to ensure the image https://example.com/image.png does not vanish:

  • http://localhost:3000/https://example.com/image.png will fetch the resource once and then deliver it from the local cache
  • http://localhost:3000/latest/https://example.com/image.png will fetch the resource with every request until it gets unavailable and then serve it from local cache

This also works with parameters:

http://localhost:3000/https://pbs.twimg.com/media/somemediaid?format=jpg&name=4096x4096

If you do have some service (like Discord) screwing up these URLs you can apply base64 URL-Encoding to them (do NOT omit the padding):

http://localhost:3000/b64:aHR0cHM6Ly9wYnMudHdpbWcuY29tL21lZGlhL3NvbWVtZWRpYWlkP2Zvcm1hdD1qcGcmbmFtZT00MDk2eDQwOTY=

Select Storage Provider

Local files

preserve \
  --listen=:3000 \
  --storage-provider=local \
  --storage-dir=/var/lib/preserve

Google Cloud Storage

preserve \
  --listen=:3000 \
  --storage-provider=gcs \
  --bucket-uri=gs://mybucket/prefix

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
storage
Package storage defines the interface to talk to the storage backends
Package storage defines the interface to talk to the storage backends
storage/gcs
Package gcs implements a storage backend saving files in GCS
Package gcs implements a storage backend saving files in GCS
storage/local
Package local implements a storage.Storage backend for local file storage
Package local implements a storage.Storage backend for local file storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL