Skip to content
This repository has been archived by the owner. It is now read-only.

How does ipfs find the names of files? #163

Closed
kevinsimper opened this issue Aug 18, 2016 · 4 comments

Comments

Projects
None yet
4 participants
@kevinsimper
Copy link

commented Aug 18, 2016

If you hash a directory, then the files inside that hash can be pointed at with their original name? How is that possible, because each file can still be addressed individually by their hash.

@Ghoughpteighbteau

This comment has been minimized.

Copy link

commented Aug 18, 2016

The base component of everything in IPFS is the "Block". and the block basically can be a list of names to hashes, or a list sub blocks and a blob.

~ $ ipfs object get QmSszskauNW84RVSjuKwKhi1uv8xkgDG2dUiaWEZaMM21S | jq
{
  "Links": [
    {
      "Name": "README.md",
      "Hash": "Qmbs8nJ2pDFUXbrxKgQdok5F3j46CeQ6H3SKiSqShzhtkE",
      "Size": 167
    },
    {
      "Name": "assets",
      "Hash": "QmY9hi4p7hhZWQ1KmkcUdurXTuZewRxs7SPZfEuAm92nfg",
      "Size": 2085821
    },
    {
      "Name": "index.html",
      "Hash": "QmZV31M1TXgVZYEGEYotbU24BnEm4QL627cGpMcUGGFPCH",
      "Size": 95193
    },
    {
      "Name": "mapbox-gl.css",
      "Hash": "QmXYv8fM2khaFR7HRAaipPQgvHpJQJ6xqRrLEeMnRQdQn6",
      "Size": 6404
    },
    {
      "Name": "mapbox-gl.js",
      "Hash": "QmeWwLgpujVtj6wpwKcfQZuq5gUdWwnFTc4NPkeyVi9Vo9",
      "Size": 322137
    },
    {
      "Name": "mapbox-gl.js.map",
      "Hash": "QmTvQQjBd3HUi65hyFdeejCLvEMD5TZsUSsEk3ZchdaRHn",
      "Size": 1139693
    }
  ],
  "Data": "\b\u0001"
}
~ $ ipfs object get QmTAJnMHpMLL8GF3WZjEAoMWo2eLDscBxBvCuLU3zCCZhp | jq
{
  "Links": [
    {
      "Name": "",
      "Hash": "QmPEEQPsErRnPhXr4Zst5P2Zfmstcxxm59iNjDzz2dhYqy",
      "Size": 45623854
    },
    {
      "Name": "",
      "Hash": "QmWAoGsvLQTPH54uqx3H3kGFHJ99GdztygNLKiCKsZ5T6U",
      "Size": 6796349
    }
  ],
  "Data": "\b\u0002\u0018���\u0018 ���\u0015 �۞\u0003"
}

so Readme.md is addressed in two ways in IPFS. Indirectly through this directory Block.

~ $ ipfs cat QmSszskauNW84RVSjuKwKhi1uv8xkgDG2dUiaWEZaMM21S/README.md
# OSM vector tiles on IPFS

...

or directly through its hash.

~ $ ipfs cat Qmbs8nJ2pDFUXbrxKgQdok5F3j46CeQ6H3SKiSqShzhtkE
# OSM vector tiles on IPFS
...
@kevinsimper

This comment has been minimized.

Copy link
Author

commented Aug 18, 2016

Okay, really good answer 👍 I have not used object yet!

@Kubuxu

This comment has been minimized.

Copy link
Member

commented Aug 18, 2016

Only note: there is difference between objects and blocks, blocks are uninterpreted blobs (ipfs block) and objects are blocks in unifs format.

@flyingzumwalt

This comment has been minimized.

Copy link
Contributor

commented May 23, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.