AW: CBOR Tutorial

Am I right then that for a content document in HTML CBOR only means a 1:1 translation of UTF-8 codes into a binary format that would have exactly the same file size. If this is true, I’m afraid I don’t see (yet?) the connection to Web Packaging and the rationale for exchanging a human-readable format for a binary format. Or do I perhaps miss decisive goodies?

Cheers,
Wolfgang

Von: Leonard Rosenthol [mailto:lrosenth@adobe.com]
Gesendet: Dienstag, 30. Januar 2018 18:41
An: Ivan Herman; Davis, Greg
Cc: Richard Wright; W3C Publishing Working Group
Betreff: Re: CBOR Tutorial

I’ve been working with CBOR on some other projects, so I can answer these (and other) questions for you.

IMO, there are three main benefits of CBOR over JSON
1 – Compact (binary) representation
2 – Able to be read & written entirely as a stream (with little/no memory overhead)
3 – Support for additional data types (incl. custom ones)

You can either do something like an HTML file as a UTF-8 text string (major type 3) or a byte string (major type 2), provided you have the length ahead of time.  CBOR also supports indefinite length strings and streams (https://tools.ietf.org/html/rfc7049#section-2.2.2) in the case that you are streaming.  You may also want to use either a custom tag to differentiate the type of stream or some preceding map/dictionary with info such as the name and/or mediatype.

You are correct that there is no inherent compression for the data (as that would be in something like ZIP or PDF), so that you would need to add that on top of your CBOR representation (again either way a custom tag or map)

Leonard

From: Ivan Herman <ivan@w3.org<mailto:ivan@w3.org>>
Date: Tuesday, January 30, 2018 at 10:57 PM
To: "Davis, Greg" <greg.davis@pearson.com<mailto:greg.davis@pearson.com>>
Cc: Richard Wright <rkwright@geofx.com<mailto:rkwright@geofx.com>>, W3C Publishing Working Group <public-publ-wg@w3.org<mailto:public-publ-wg@w3.org>>
Subject: Re: CBOR Tutorial
Resent-From: <public-publ-wg@w3.org<mailto:public-publ-wg@w3.org>>
Resent-Date: Tue, 30 Jan 2018 17:27:05 +0000

Yes, I have also played on the playground:-)

While we are at it, maybe somebody can help me understand. I understand that CBOR is great to compact, say, JSON structures (and even some more), so it is really good when JSON messages are sent around. However, I am not sure how CBOR would be used for content like an HTML file (put into the package). Does it mean that the full content would be encoded as a single CBOR string? Do we have data on how efficient that is? My understanding of the CBOR spec is that UTF-8 characters are simply encoded as… UTF-8 characters, ie, what do we gain?

Thanks

Ivan

On 30 Jan 2018, at 18:03, Davis, Greg <greg.davis@pearson.com<mailto:greg.davis@pearson.com>> wrote:

Thanks Ivan and Ric!

My favorite tool to play around and understand how it works:
http://cbor.me/


-Greg

On Tue, Jan 30, 2018 at 9:15 AM, Ric Wright <rkwright@geofx.com<mailto:rkwright@geofx.com>> wrote:
Thanks Ivan!  Video quality leaves a lot to be desired. Personally, I am too impatient for long videos so found:

http://cbor.io<https://urldefense.proofpoint.com/v2/url?u=http-3A__cbor.io&d=DwMFAw&c=0YLnzTkWOdJlub_y7qAx8Q&r=LFZDO9uuKE7JU9Eda_9bzWwAp0k2lV_ZRb2NgDA-WYA&m=SztZ_ef7gOECpNaNegVfPJ_24cfCggo_B3Y_bhu-xzY&s=BnZF_Nn0lwEny6IrNfNIBqx7ryw5UCNzPol-iH5PLfU&e=>/

https://tools.ietf.org/html/rfc7049<https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc7049&d=DwMFAw&c=0YLnzTkWOdJlub_y7qAx8Q&r=LFZDO9uuKE7JU9Eda_9bzWwAp0k2lV_ZRb2NgDA-WYA&m=SztZ_ef7gOECpNaNegVfPJ_24cfCggo_B3Y_bhu-xzY&s=NGlRhbFCD18VxeNTQFK-EjTLdOZRmIkiB7RF4ag1kLA&e=>

And of course, there’s always Jimmy:

https://en.wikipedia.org/wiki/CBOR<https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_CBOR&d=DwMFAw&c=0YLnzTkWOdJlub_y7qAx8Q&r=LFZDO9uuKE7JU9Eda_9bzWwAp0k2lV_ZRb2NgDA-WYA&m=SztZ_ef7gOECpNaNegVfPJ_24cfCggo_B3Y_bhu-xzY&s=CaR08yomt8jdn2pVfmLp1e-fDBfrCwqfHHC62dVZg8U&e=>

Ric



On 1/30/18, 9:49 AM, "Ivan Herman" <ivan@w3.org<mailto:ivan@w3.org>> wrote:

Just because we talked about it and not everyone knows CBOR, I found a tutorial on youtube:

https://www.youtube.com/watch?v=nihSTzbs3fs<https://urldefense.proofpoint.com/v2/url?u=https-3A__www.youtube.com_watch-3Fv-3DnihSTzbs3fs&d=DwMFAw&c=0YLnzTkWOdJlub_y7qAx8Q&r=LFZDO9uuKE7JU9Eda_9bzWwAp0k2lV_ZRb2NgDA-WYA&m=SztZ_ef7gOECpNaNegVfPJ_24cfCggo_B3Y_bhu-xzY&s=9xjlUpCTsw9XZPIW5FivUNi-fw9ybD9gCc82tsedatY&e=>

Ivan

----
Ivan Herman, W3C
Publishing@W3C Technical Lead
Home: http://www.w3.org/People/Ivan/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_People_Ivan_&d=DwMFAw&c=0YLnzTkWOdJlub_y7qAx8Q&r=LFZDO9uuKE7JU9Eda_9bzWwAp0k2lV_ZRb2NgDA-WYA&m=SztZ_ef7gOECpNaNegVfPJ_24cfCggo_B3Y_bhu-xzY&s=yVETIyv2A5XNzGpl4CJv-Ur0rMJhUnT8f0N3DJSiMGc&e=>
mobile: +31-641044153<tel:+31%206%2041044153>
ORCID ID: http://orcid.org/0000-0003-0782-2704<https://urldefense.proofpoint.com/v2/url?u=http-3A__orcid.org_0000-2D0003-2D0782-2D2704&d=DwMFAw&c=0YLnzTkWOdJlub_y7qAx8Q&r=LFZDO9uuKE7JU9Eda_9bzWwAp0k2lV_ZRb2NgDA-WYA&m=SztZ_ef7gOECpNaNegVfPJ_24cfCggo_B3Y_bhu-xzY&s=dN2bC9dVTfJ2dTrGeysUUwifjXgUYRv8gWvE8kwxULU&e=>





--
Greg Davis
Manager Prototyping User Experience Design
Denver, Colorado
+1 (720)388-5371 Learn more at pearson.com<http://pearson.com/> [Image removed by sender. Pearson]


----
Ivan Herman, W3C
Publishing@W3C Technical Lead
Home: http://www.w3.org/People/Ivan/

mobile: +31-641044153
ORCID ID: http://orcid.org/0000-0003-0782-2704

Received on Tuesday, 30 January 2018 18:12:30 UTC