nrps icon indicating copy to clipboard operation
nrps copied to clipboard

FIXME: allow multiple files in content

Open milahu opened this issue 2 years ago • 3 comments

currently, content can hold only one file, usually utf8-encoded text.

it would be nice to send multiple files per event, for example:

  • text with images
  • text with video
  • video with subtitles
  • arbitrary folders of files

benefits:

  • avoid sending images as base64
  • reuse one image in multiple places
  • avoid muxing streams into one video file
  • avoid workarounds like zip-archives

this would make nostr more similar to bittorrent/zeronet/twister

milahu avatar Jun 21 '23 12:06 milahu

I think multiple files can be packed as a tar package

dr-orlovsky avatar Jun 26 '23 10:06 dr-orlovsky

at least we should add a content type, so users can describe the payload type. how about:

  • enum values from 1 to 255 = some commonly used mimetypes:
    • text/markdown; charset=utf8
    • text/html; charset=utf8
    • application/zip; charset=binary
    • application/tar; charset=binary
    • application/tar; charset=binary+application/gzip; charset=binary
    • application/x-7z-compressed; charset=binary
  • value 0 + length-prefixed utf8-string (max 255 bytes length) = custom mimetype

milahu avatar Jun 26 '23 14:06 milahu

I am not a big fan of something non-standard; the selection of 255 "common" types looks too opinionated for me...

We can allow MIME / MediaType in string representation - that is better (in binary serialization the string prefixed with one byte length).

dr-orlovsky avatar Jun 28 '23 21:06 dr-orlovsky