Skip to Content
Hands-On Blockchain for Python Developers
book

Hands-On Blockchain for Python Developers

by Arjuna Sky Kok
February 2019
Intermediate to advanced
450 pages
9h 59m
English
Packt Publishing
Content preview from Hands-On Blockchain for Python Developers

Mutable File System

The IPFS has a feature called Mutable File System (MFS). The MFS is different from your OS file system. Let's create a script to explore this feature and name the script exploring_mfs.py:

import ipfsapiimport ioc = ipfsapi.connect()print("By default our MFS is empty.")print(c.files_ls('/')) # root is / just like Unix filesystemprint("We can create a directory in our MFS.")c.files_mkdir('/classical_movies')print("We can create a file in our MFS.")c.files_write('/classical_movies/titanic',              io.BytesIO(b"The ship crashed. The end."),              create=True)print("We can copy a file in our MFS.")c.files_cp('/classical_movies/titanic',           '/classical_movies/copy_of_titanic')print("We can read the file.")print(c.files_read('/classical_movies/titanic')) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Blockchain in Action

Blockchain in Action

Bina Ramamurthy
Learn Python by Building a Blockchain and Cryptocurrency

Learn Python by Building a Blockchain and Cryptocurrency

Academind by Maximilian Schwarzmüller GmbH

Publisher Resources

ISBN: 9781788627856Supplemental Content