ubbase64 – manage blobs


ubbase64 – store and retrieve documents, spreadsheets, presentations, text, and images in a table using base64 encoding


ubbase64 –function get|put –attribute <attribute> –key <key> –match <match> {–format csv|html|json|textarea|ubxml2pdf} {–lf <line feed substition text>} {–width <characters>} {–file <file to upload>} <table>


ubbase64 is used to store and retrieve BLOBs (binary large objects) such as documents, spreadsheets, presentations, text, and images in a Unibase table.

Typically this is used to store random text and images, but can be used for anything. A really good use is notes specific to a record or creating schedules, to-do lists, and so on.

The table to be used for storage needs to have a specific format. Two attributes, the first being the index attribute and the second an attribute of that is used to store the base64 encoded BLOB. This storage attribute can be any suitable length. Typically this will be 60-100 characters for small blobs but may be 1000+ for large blobs. Wasted space will be attribute size / 2 on average.


: note
noteNumber, 6
note, 60

A separate table is normally used to hold meta information about the note.

Unibase guarantees the order of data stored so there is no need to be more specific about the indexes.

To store a BLOB you must specify the function as put and the attribute to store the BLOB in, the key in the table, the match value, and the table name.

When storing data ubbase64 reads stdin for data unless the –file argument is supplied. In this case the data is the contents of the specified file.

To retrieve a blob use the function get along with the other attributes.

The retrieved BLOB is output on stdout.

ubbase64 can also format a text BLOB so that it is suitable for display in html (–format html), for use in a textarea input (–format textarea), or for use with ubxml2pdf (–format ubxml2pdf).

If no –format option is given then ubbase64 will return the original object.


–attribute<text>database attribute used to save BLOBYes
–functionget|put get (retrieve) or put (save)Yes
csv – csv output of data
html or textarea – Used for editing in Unibase forms (prompts)
json – output as JSON array. Each record is in the format {“key”: “…”, “data”: “…”}
list – output as unordered list
p – output is a paragraph that can wrap in outher elements
textxml –
ubxml2pdf – format is suitable to be usined for ubxml2pdf
–key<text> name of key to matchYes
–lf<text>text to substitute for lf (\n). This only applies to ubxml2pdf output format. The default text is “</text></line><line><text>”No
–match<text> value to matchNo


  • Retrieve the description
    • ubbase64 –function get –key style_id –attribute descriptionHTML –match 006407 styleDescriptionHTML
  • Retrieve all descriptions
    • ubbase64 –function get –key style_id –attribute descriptionHTML styleDescriptionHTML
  • Retrieve text and format for ubxml2pdf
    • ubbase64 –function get –key style_id –attribute descriptionHTML –format ubxml2pdf –match 006407 styleDescriptionHTML
  • Retrieve text and format for ubxml2pdf with special line start
    • ubbase64 –function get –key style_id –attribute descriptionHTML –format ubxml2pdf –match 006407 –lf ‘</text></line><line><text pos=”0.1″>’ styleDescriptionHTML