Connect with one of our privacy experts to run this code.
How Does It Work?
Limina support for file processing comes in unified endpoints which works with either base64-encoded files or URIs:/process/files/base64 and /process/files/uri.
Base64
Thebase64 endpoint is the recommended way to process files for most users, as there is no need to mount a volume into the container and ensure that permissions are set correctly. To use the base64 endpoint, you first need to read the file in memory, encode its content with base64, and send it to the base64 endpoint. You also need to pass the MIME type of the file as a hint to the file processing pipeline. The Supported File Types page details extensions and MIME types for both endpoints
URI
Available on the container only, theuri endpoint is suitable for larger data volumes and has the following advantages over the base64 endpoint:
- No overhead of base64 encoding.
- No need to first read the file in memory.
- The processed file is saved automatically by the container.
.redacted suffix added to the original name. For example, the uri endpoint will access the file /some/path/my-doc.pdf, it will redact it and create a file my-doc.redacted.pdf with the redacted contents at the location specified by the user. When using the uri endpoint, the file extension is used to determine the file type.
Diving Deeper
Processing files with the base64 endpoint
When using the /process/files/base64 endpoint, there is no need to mount a folder into the container.
Docker Command
base64 shell command. Assuming you have the file sample.pdf saved in the current folder:
An example Python script showing how to process files with Limina’s Python client using the base64 route can be found here.
Processing files with the uri endpoint
To process files with the /process/files/uri endpoint you are required to mount a volume when starting the container.
In addition, the service requires access to a folder where the redacted files will be stored. This is done with the PAI_OUTPUT_FILE_DIR environment variable. This variable must point to a folder that is mounted into the container as output folder.
Docker Command
files folder in the admin home folder as input, output folder as output location.
Docker Command
An example Python script showing how to process files with Limina’s Python client using the URI route can be found here.
/home/admin/files/output/sample.redacted.pdf.
A note on permissionsFiles created by the container will have the owner and permissions of the user running the docker service. This is commonly found to be
root in default installations. However, you can change the user running the container using the docker --user option.This command will run the same container with the current user.Docker Command