I've uploaded some files using js-ipfs without converting it into Buffer or Readable stream, and it works just fine.
since IPFS converts the file into blocks anyway, why use buffer/stream!
what are the pros and cons of this?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityThat depends on the service you use to upload the files. They may have different requirements, but the end result is the same.
Using buffers/streams is mostly useful if you're dealing with lots of data and/or in an environment where memory is limited. Streaming data means you don't transfer all at once, but send smaller pieces all the time. That wait the recipient doesn't need to accept a big file at once, which may drain resources.