RPC API Read & Writing Files

A simple solution for you would be to add a file with /add endpoint, which generates a Content Identifier (CID) to the file, which in turn can be used to get the file content using the /get endpoint.

IPFS doesn’t have the concept of writing because every file when added is hashed to generate a CID so when you change a file and add it to IPFS it will be hashed again which will produce a new CID, thus becoming a new file to IPFS.

The second pair of links you sent are from what is called Mutable File System (MFS), which consists in mounting a File System (FS) in your machine, exposing the
FS interface we are used to and in the background turns those to other IPFS calls such as add and get. For example, when you write to a file in MFS, IPFS will automatically do that call to /add, and when you read the file it will also do the calls for /get.

You can learn more about MFS here and here is another explanation of the difference between the two ways of adding files.

Hoped I could help you ^^

1 Like