I'm trying to upload a file from my directory to IPFS.
Below is what they require from API:
const files = [
{
path: '/tmp/myfile.txt',
content: (Buffer or Readable stream)
}
]
ipfs.files.add(files, function (err, files) {
// 'files' will be an array of objects containing paths and the multihashes of the files added
})
I don't understand what they mean by "Buffer or Readable stream." More specifically, I'm not sure how to implement it correctly because I haven't done it before.
What is the difference between "path" and "content"? Why do they need to be separated?
Source: https://github.com/ipfs/js-ipfs/tree/master/examples/ipfs-101