Your script has limited access to the filesystem. Expanded access is on our roadmap.

The files request parameter

If you are operating on multiple files this is the best option.

The execute code endpoint accepts a files parameter which is a list of file objects. Each file object has a path parameter and a contents parameter. Riza makes each file in the list available at the specified path, relative to /mnt/req/.

For instance, if you pass the following files list to the API then your script will have access to two files located at /mnt/req/people.csv and mnt/req/img/riza.svg.

{
  "files": [
    {"path": "people.csv", "contents": "Aaron,21,CA"},
    {"path": "img/riza.svg", "contents": "<?xml version="1.0" standalone="no"?><!DOCTYPE svg..."}
  ]
}

stdin and stdout

If you only need to operate on a single file this may be the best option.

The execute code endpoint accepts a string stdin parameter. The API sets any value you provide as stdin for the executed script.

You can encode the bytes of your file as a string (base64 encoding is a good choice) and pass it to the API as the stdin parameter. Just remember to decode the bytes you read from stdin within your script.

If you’ve manipulated the file and want to get it back, you can just do the reverse. Encode the bytes of the file as a string within your script, and print to stdout. The resulting string is available in the stdout parameter of the API response.