manbytesgnu_site

Source files for manbytesgnu.org
git clone git://holbrook.no/manbytesgnu_site.git
Log | Files | Refs

20210510_ipfs_api_dissect.rst (2803B)


      1 Dissecting the IPFS get
      2 #######################
      3 
      4 :title: Dissecting the IPFS API
      5 :date: 2021-05-01 08:40
      6 :slug: ipfs-api-get
      7 :category: Code
      8 :status: draft
      9 
     10 
     11 .. code-block:: bash
     12 
     13         $ curl -X POST "http://localhost:5001/api/v0/object/get?arg=QmWajb6k7oT9HVTq5hgnGZqRxzwwA2g7D33MFjzd2nVcXw"  
     14         {"Links":[{"Name":"","Hash":"QmZeEX1hbQtj34TPLdbUwbFtQBGAmanTVUB6HuiTcrLrfQ","Size":262158},{"Name":"","Hash":"QmWdaV34ArzVJH2Si9CxS9b5SxCnmU1HMuEXNA137XoV4f","Size":262158},{"Name":"","Hash":"QmUgSEJDRj7So3x7n8RaUfiLfcDy5CyqY7btJdm6B7z4Ae","Size":131390}],"Data":"\u0008\u0002\u0018\ufffd\ufffd( \ufffd\ufffd\u0010 \ufffd\ufffd\u0010 \ufffd\ufffd\u0008"}
     15 
     16 .. code-block:: bash
     17 
     18         $ curl -X POST "http://localhost:5001/api/v0/get?arg=QmZeEX1hbQtj34TPLdbUwbFtQBGAmanTVUB6HuiTcrLrfQ" | hexdump -C -n1024
     19         00000010  4c 64 62 55 77 62 46 74  51 42 47 41 6d 61 6e 54  |LdbUwbFtQBGAmanT|
     20         00000020  56 55 42 36 48 75 69 54  63 72 4c 72 66 51 00 00  |VUB6HuiTcrLrfQ..|
     21         00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     22         *
     23         00000060  00 00 00 00 30 30 30 30  36 34 34 00 30 30 30 30  |....0000644.0000|
     24         00000070  30 30 30 00 30 30 30 30  30 30 30 00 30 30 30 30  |000.0000000.0000|
     25         00000080  31 30 30 30 30 30 30 00  31 34 30 34 36 31 35 33  |1000000.14046153|
     26         00000090  30 33 36 00 30 31 37 31  37 32 00 20 30 00 00 00  |036.017172. 0...|
     27         000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     28         *
     29         00000100  00 75 73 74 61 72 00 30  30 00 00 00 00 00 00 00  |.ustar.00.......|
     30         00000110  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     31         *
     32         00000140  00 00 00 00 00 00 00 00  00 30 30 30 30 30 30 30  |.........0000000|
     33         00000150  00 30 30 30 30 30 30 30  00 00 00 00 00 00 00 00  |.0000000........|
     34         00000160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
     35         *
     36         00000200  47 49 46 38 39 61 f4 01  7b 01 f7 fb 00 94 31 17  |GIF89a..{.....1.|
     37         00000210  ac c7 d8 a8 c6 ec d5 70  4b 90 8a 71 e9 cd a9 c6  |.......pK..q....|
     38 
     39 .. code-block:: bash
     40 
     41         $ curl -X POST "http://localhost:5001/api/v0/get?arg=QmZeEX1hbQtj34TPLdbUwbFtQBGAmanTVUB6HuiTcrLrfQ" | dd bs=512 skip=1 > pat.gif
     42         $ curl -X POST "http://localhost:5001/api/v0/get?arg=QmWdaV34ArzVJH2Si9CxS9b5SxCnmU1HMuEXNA137XoV4f" | dd bs=512 skip=1 >> pat.gif
     43         $ curl -X POST "http://localhost:5001/api/v0/get?arg=QmUgSEJDRj7So3x7n8RaUfiLfcDy5CyqY7btJdm6B7z4Ae" | dd bs=512 skip=1 >> pat.gif
     44 
     45 .. code-block:: bash
     46 
     47         $ curl -X POST "http://localhost:5001/api/v0/cat?arg=QmWajb6k7oT9HVTq5hgnGZqRxzwwA2g7D33MFjzd2nVcXw" -o pat2.gif
     48         $ diff pat2.gif pat.gif
     49         $ echo $?
     50         0