mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-13 02:46:24 +00:00
59 lines
2.5 KiB
Markdown
59 lines
2.5 KiB
Markdown
NIP-94
|
||
======
|
||
|
||
File Metadata
|
||
-------------
|
||
|
||
`draft` `optional`
|
||
|
||
The purpose of this NIP is to allow an organization and classification of shared files. So that relays can filter and organize in any way that is of interest. With that, multiple types of filesharing clients can be created. NIP-94 support is not expected to be implemented by "social" clients that deal with `kind:1` notes or by longform clients that deal with `kind:30023` articles.
|
||
|
||
## Event format
|
||
|
||
This NIP specifies the use of the `1063` event type, having in `content` a description of the file content, and a list of tags described below:
|
||
|
||
* `url` the url to download the file
|
||
* `m` a string indicating the data type of the file. The [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types) format must be used, and they should be lowercase.
|
||
* `x` containing the SHA-256 hexencoded string of the file.
|
||
* `ox` containing the SHA-256 hexencoded string of the original file, before any transformations done by the upload server
|
||
* `size` (optional) size of file in bytes
|
||
* `dim` (optional) size of file in pixels in the form `<width>x<height>`
|
||
* `magnet` (optional) URI to magnet file
|
||
* `i` (optional) torrent infohash
|
||
* `blurhash`(optional) the [blurhash](https://github.com/woltapp/blurhash) to show while the file is being loaded by the client
|
||
* `thumb` (optional) url of thumbnail with same aspect ratio
|
||
* `image` (optional) url of preview image with same dimensions
|
||
* `summary` (optional) text excerpt
|
||
* `alt` (optional) description for accessibility
|
||
* `fallback` (optional) zero or more fallback file sources in case `url` fails
|
||
* `service` (optional) service type which is serving the file (eg. [NIP-96](96.md))
|
||
|
||
```jsonc
|
||
{
|
||
"kind": 1063,
|
||
"tags": [
|
||
["url",<string with URI of file>],
|
||
["m", <MIME type>],
|
||
["x", <Hash SHA-256>],
|
||
["ox", <Hash SHA-256>],
|
||
["size", <size of file in bytes>],
|
||
["dim", <size of file in pixels>],
|
||
["magnet", <magnet URI> ],
|
||
["i", <torrent infohash>],
|
||
["blurhash", <value>],
|
||
["thumb", <string with thumbnail URI>, <Hash SHA-256>],
|
||
["image", <string with preview URI>, <Hash SHA-256>],
|
||
["summary", <excerpt>],
|
||
["alt", <description>]
|
||
],
|
||
"content": "<caption>",
|
||
// other fields...
|
||
}
|
||
```
|
||
|
||
## Suggested use cases
|
||
|
||
* A relay for indexing shared files. For example, to promote torrents.
|
||
* A pinterest-like client where people can share their portfolio and inspire others.
|
||
* A simple way to distribute configurations and software updates.
|