Block to simplify sending and receiving files from your balena device
Use this as standalone with the button below:
Or add the following service to your docker-compose.yml
:
version: "2.1"
volumes:
files:
services:
file-transfer:
restart: always
image: ghcr.io/rcooke-warwick/file-transfer:latest
volumes:
- 'files:/data'
ports:
- "80:3000"
If you want to use a webserver exposing a public facing page, you will need to remove the exposed port 80
This block has 2 endpoints, to allow you to send and receive files to and from a balena device. You must make sure that any service that you want to use with this block shares the files
volume with it.
To download files from your device using this block, move the files you want to retrieve into the download
directory in the files
volume.
You can then retreive a .tar.gz
archive with all files in this volume using the /download
endpoint of the block, for example:
curl DEVICE_URL/download --output files.tar.gz
To send files to the device, you must first create a .tar.gz
archive with these files, for example:
tar -czvf files.tar.gz FOLDER_TO_UPLOAD/
then make a POST to the /upload
endpoint:
curl -X POST --data-binary @file.tar.gz DEVICE_URL/upload
Your files will then be available in the upload
directory of the files
volume.
If you're having any problem, please raise an issue on GitHub and we will be happy to help.
balenablock-template is free software, and may be redistributed under the terms specified in the license.