bee-js icon indicating copy to clipboard operation
bee-js copied to clipboard

Extend upload functionality on the FeedWriter interface

Open agazso opened this issue 4 years ago • 0 comments

Currently there is only an upload function on the FeedWriter interface that expects a reference to be passed. This means that you are supposed to first use uploadData, uploadChunk, uploadFile or uploadFiles functions on the Bee class, then pass the returned reference to the upload function on the FeedWriter.

While this works and it gives you total control, maybe it would be more convenient to have the same functions on the FeedWriter interface directly to simplify common use-cases.

For example, this:

const feed = bee.makeFeedWriter('sequence', topic)
const ref = await bee.uploadData(postageBatchId, data)
await feed.upload(postageBatchId, ref)

Could be written instead like this:

const feed = bee.makeFeedWriter('sequence', topic)
await feed.uploadData(postageBatchId, data)

agazso avatar Dec 17 '21 17:12 agazso