How to represent multiple files in a forum post?

Jonathan Marler johnnymarler at gmail.com
Sun Feb 18 21:58:37 UTC 2018


On Sunday, 18 February 2018 at 21:40:34 UTC, Martin Nowak wrote:
> On Sunday, 18 February 2018 at 04:04:48 UTC, Jonathan Marler 
> wrote:
>> If there is an existing standard that's great, I wasn't able 
>> to find one.  If you find one let me know.
>
> Found ptar (https://github.com/jtvaughan/ptar) and shar 
> (https://linux.die.net/man/1/shar), both aren't too good fits, 
> so indeed a custom format might be in order.

Interesting. Shar definitely doesn't fit the bill (I used it to 
archive a simple file and got a HUGE shell file).  However, PTAR 
is interesting.  Here's the example they provide 
(https://github.com/jtvaughan/ptar/blob/master/FORMAT.md#example-archive)

======================================================================
PTAR
======================================================================
Metadata Encoding: utf-8
Archive Creation Date: 2013-09-24T22:41:20Z

Path: a.txt
Type: Regular File
File Size: 32
User Name: foo
User ID: 1000
Group Name: bar
Group ID: 1001
Permissions: 0000664
Modification Time: 1380015036
---
These are the contents of a.txt
---

Path: b.txt
Type: Regular File
File Size: 32
User Name: foo
User ID: 1000
Group Name: baz
Group ID: 522
Permissions: 0000664
Modification Time: 1380015048
---
These are the contents of b.txt
---


In HAR you could represent the same 2 files (omitting all the 
metadata) with:

======================================================================
HAR
======================================================================
--- a.txt
These are the contents of a.txt

--- b.txt

These are the contents of b.txt


The PTAR format may be saved if many of the fields were optional, 
however, it appears that most of them are always required, i.e.
> NOTE: Unless otherwise specified, all of the aforementioned 
> keys are required. Keys that do not apply to a file entry are 
> silently ignored.

If the standard was changed though (along with making the initial 
file header optional), the example could be slimmed down to this:


Path: a.txt
---
These are the contents of a.txt
---

Path: b.txt
---
These are the contents of b.txt
---

This format looks fine, but it's a big modification of PTAR as it 
exists.



More information about the Digitalmars-d mailing list