User:MihaiEso/Esoteric formats/Human Readable Archive (HRA)

From Esolang
Jump to navigation Jump to search

HRA (.hra), also known as Human Readable Archive, is a file format made by Mihai Popa. It's a text-based, human-readable archive format. Use to store multiple files in one file!

Syntax

All HRA files must start with this:

<~= HRA File =~>

Comment blocks are allowed, start with <= Comment => then the text contents. It ends when there's a file block. Both multi-line and nesting are allowed.

<= Comment =>
This is just a comment! Bla bla bla...
Multi-line ones are allowed
<= Comment =>
Nesting is allowed!
<= File => hello.txt
Hello, world!

After that, there's the file block (you can add as many as you want, 1 block per file only). Syntax is:

<= File => hello.txt
Hello, world!

Examples

First example

<~= HRA File =~>
<= File => hello.txt
Hello, world!

Second example, with a comment

<~= HRA File =~>
<= Comment =>
This is a comment.
HRA is my own format for text-based, human-readable archives.
<= File => hra.txt
You can create this file right now!

Third example, with a HRA file

<~= HRA File =~>
<= Comment =>
You can even add HRA files inside this archive
<= File => simple.hra
<~= HRA File =~>
<= File => hello.txt
Hello, world!

Fourth example, with directory paths!

<~= HRA File =~>
<= Comment =>
This one has directory paths.
<= File => dir/hello.txt
Hello, world!
<= File => dir/hello2.txt
Hello!
<= File => dir2/toadette.txt
Toadette (Astroanut)

Fifth example, with a binary file (encoded as Base64)!

<~= HRA File =~>
<= Comment =>
This HRA file has a binary file (encoded as Base64)!
<= File => codec2.c2.b64
wN7CAAgIAM72gADOzkAQzvaAEDp+ABDuVNWwDR5+cLo0fnDn+P5wGWX+YLBOamAJ
NHPgbqhz8OususAc5f7gGFm+0BZs/sAoRCqQKHMmULBOZjAuWbIQfPLkAKfXWABC
n5AAjgyuEE0qveDgLLXAHM9VAOU/EiBZdrYQZXL+IGU/ffD4inmQ2C7xIJUCnSDz
gVVAiTlJcBFswBDO9oAg7vaAEAkoZTCLT53gztuIkDpn6/DgAmhgeDlw0Dood/D8
LqswCS6nABz4wDDunoAQ7o3AEAkNneA6cwGwRPMU0AxJkYBlrLNw2EJ+ECb/viBJ
rLIw5S7aIBRDxKD7gVBQ5XjWMM7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wDQhqtAEPZXQBD6LoAQzvEAEM72gBDO9oAQzvaAEM7OQBDuz4AQfOnAsHysgKDu
3wCAfIFAEHysgGDO8QAQ7p6AMO7fABDuz4EAk49AEA==

Sixth example, with only a comment and nothing else!

<~= HRA File =~>
<= Comment =>
Comment!

Seventh example, with Unicode and weird names.

<~= HRA File =~>
<= Comment =>
This one has Unicode and weird filenames.
<= File => 😉.txt
Wink emoji
<= File => ~!@#$%^&*()_+{}:"|<>?.doc
This one has weird symbols.
<= File => .dot.txt
This one has a dot before the letters.

Eighth example, with multiple files.

<~= HRA File =~>
<= Comment =>
This HRA file has 5 files:
* a text file
* a HTML file
* a CSS file
* a JS file
* and a RTF file
<= File => file.txt
Hello, world!
<= File => hello.html
<html>
<head>
<title>HTML test page</title>
</head>
<body>
<h1>HTML test page</h1>
<p>Hello, world!</p>
</body>
</html>
<= File => styles.css
html {
font-family: Arial;
font-size: 18px;
}
p {
padding: 8px;
}
<= File => script.js
console.log("Hello, world!");
<= File => example.rtf
{\rtf1 Hello, world!\par\b Bolded! \b0\i and italic...\i0}

A archiver, written by myself, in Batch (turns any number of files in HRA)

@echo off
rem Program to turn any text/binary (as Base64) files in HRA (Human Readable Archive)
rem Drag and drop, multiple files support.

cd %~dp0
mkdir Output
echo ^<~= HRA File =~^> >> Output\archive.hra
echo ^<= Comment =^> >> Output\archive.hra
echo This is a HRA file, generated by my own program! >> Output\archive.hra
for %%A in (%*) do (
echo ^<= File =^> %%~nxA >> Output\archive.hra
type %%A >> Output\archive.hra
)