In this quick tutorial, we will cover “Document and File Type Handling”. The Catenis system is exceptionally flexible, and can handle logging and sending or messaging data of any size or type. Catenis was designed with powerful data-agnostic capabilities. A common use case of blockchain technology is to log or send files with their respective mime types, such as word documents, PDF documents, mp4 movies, or mp3 music.
Catenis accepts and transmits everything via a byte stream making it extremely powerful. Continue watching this video to fully understand how handling files work.
In this video we will cover:
Prerequisite
Thank you for watching Document and File Type Handling in the Catenis Flow tutorial series. Watch the next video, Understanding the Log Message Node, to further expand your knowledge.
Links from this video for easy access:
To sign up for your free account, head to our website www.blockchainofthings.com.
Join our community forum for the quickest response time to all your questions and concerns. This forum is our customer support. https://forum.blockchainofthings.com/
[Music]
Hi, this is Clara for Blockchain of Things.
Today, we’ll learn how to handle document
and file types in Catenis Flow.
The Catenis system is extremely flexible, and can handle logging and sending, or messaging data of any size or type.
Catenis was designed with powerful
information-agnostic capabilities,
so it can be used by a myriad of
applications across an endless number of industries.
A common use case of blockchain technology is to log
or send files with their respective mime types.
Such as Word documents, PDF documents,
MP4 movies, or MP3 music.
These files can only be opened by their respective client applications and computers use file extensions
to help identify the file’s mime types.
Catenis on the other hand, accepts and
transmits everything via a byte stream
which makes it extremely powerful.
However, Catenis does not have any notion
of a file type, nor the file’s extension.
When handling documents or files, we need
to build a simple protocol to pass to Catenis.
The content of the file, along with the name
and its extension as one-byte stream in a specific encoding type
Such as base64 which is typically used for files.
When receiving the payload from Catenis,
we need to run through the same protocol and extract the file name
and extension from the payload and
reassemble it as a file, then save it.
To make this implementation easier, we have pre-written a flow and a helper module
called the Catenis File Module.
Let’s install and configure the module and example flow now,
so that you have a template to use for handling documents and file types in your own applications.
You can install the Catenis File Module into Node-RED by first navigating to the folder
in which you installed your settings file.
Which is typically Node-RED’s default user directory.
You can double-check that you are installing into the correct directory by opening your terminal
and entering this command to navigate to the
directory where we expect the settings file to be
and then enter the LS command to list the directory contents.
If you see a file called settings.js, then you’re in the right place.
If you can’t find your settings file,
go to this link for instructions on how to find your settings file.
Once you have navigated to the directory containing your Node-RED settings file in your terminal,
edit the settings.js file and add the following property to the function globalcontext object.
Now, save the file.
Now, enter this command to install the Catenis File Module.
NPM space install space Catenis dash file
Now, with Node-RED running in our browser,
let’s copy an example flow into our workspace.
First, navigate to this link:
And click this link:
Now, copy the example flow provided to your computer’s clipboard.
On the Node-RED workspace, click on the hamburger menu
and click import to display the import flow dialog box.
Paste the flow into the import box and click the import button.
Now, you should see the flow you copied in a new tab.
This flow implements a basic file type handling protocol.
Anytime you need to create your own file type handling protocol,
you can begin by using this flow and modify it to your own needs.
After importing the flow, double-click on the store file Catenis Flow Log Message Node
to configure it and add a new Catenis device.
Then click done.
Then double-click on the recover file Catenis Flow
Read Message Node to configure it
and select the same Catenis device that had
been added for the Store File Node.
Then click done.
Then click deploy.
To upload a file to the Bitcoin Blockchain point your web browser to this link:
Select a file and click on upload file.
If everything goes well, you will get a message ID in response.
Take note of the message ID,
since you will
need it to download the file.
To download a file from the Bitcoin Blockchain that had been previously uploaded, point your web browser to this link:
Replacing message ID for the actual message ID that had been returned when the file was uploaded.
Now, the file will be saved to your local computer.
Great!
You’ve got all the basics and you’re ready to
move on to the next chapter in this tutorial series
Now, we’ll take a deeper dive into each of the Catenis Flow Nodes
Starting in our next tutorial with the Log Message Node.
[Music]