Remote files

What is Remote files

In Val, remote files are files which are not stored in your git repository. Instead they are living on Vals remote server. Remote files are always immutable.

Before you you start

To get started with remote files, you need to login using the CLI. Run the login command and follow the prompts.

npx -p @valbuild/cli val login

Setting up remote files schemas

Just call the `.remote()` on either a `s.image()` or `s.file()`. You will then get a validation error, if you have an existing local file. See the section below for how to upload the files.

s.image().remote() // or
s.file().remote()

Defining content

You cannot define the remote files yourself, since they have to be uploaded and they also built to be possible to validate even in offline mode.

Note, that changing the filename works, as long as the extension is the same.

// Example of a public remote file
// You can change the filename snurrebart to whatever you want
s.remote("https://remote.val.build/file/p/ce803e0/b/v08/v/0.84.1/h/637c/f/c89d27d4be02/p/public/val/snurrebart.png") 

Uploading files

If you are using the VS code plugin, you should be prompted to upload the files directly in the editor. You can also upload all files automatically using the CLI by running the validation command with the --fix option.

npx -p @valbuild/cli val validation --fix