Here we are looking at how we name files, and what folder structure we use so that assets in the Permanent Wiki can be stored conventionally, and in IPFS.
# Objectives
The aim here is to make file recovery easy to do both manually and programatically, and to play well with external IPFS based archiving (see Loose Coupling of IPFS).
# Some thoughts
IPFS multihash naming ensures that there is no possibility of a name clash as the file reference is a content addressable reference. By prepending "ipfs_" we indicate that the file has been Archived in IPFS and by adding a mime-type compatible suffix (such as ".jpg") we ensure that a conventional server can serve the file with the correct mime-type headers.
The preliminary version of this supports assets to be presented on federated wikis and uses IPFS to store the assets, which may be images, video clips, audio clips or any other form of digital media.
# File renaming example
Suppose we have an asset called fred.jpg within wiki with domain outlandish.academy. Instead of storing this on the file path:
outlandish.academy/assets/img/fred.jpg
It will then be added to ipfs, which will return the hash which uniquely identifies the file in ipfs. E.g.
ipfs add mypicture.jpg added QmUZDM7VYg....dVNQesw3 mypicture.jpg
The asset will then be renamed with the prefix ipfs_ followed by the returned hash and the original file extension. E.g: Above file mypicture.png will be renamed to:
ipfs_QmUZDM7VYgF7BaFDPdei895iSaTFCMQtyJRnCndVNQesw3.jpg
then adding it to ipfs and renaming it to ipfs_ipfs_hash.jpg, we put it in a directory with name:
then add the directory to ipfs and rename the file as above. E.g:
outlandish.academy/assets/img/fred.jpg/
# Indexes and folders
Assets come in multiple versions and encodings. An image may be provided in several resolutions and a video file encoded with different codecs.
We look to use a Media Package concept, to place all versions of an asset in the same folder. The folder is then named the same as the asset, and contains a manifest or index file which provides metadata for the asset versions contained within the folder.
# See also - Media Package - Document Package - Virtual file system - Permanent Archive - DreamFactory Wiki Files