hyperdrive-next icon indicating copy to clipboard operation
hyperdrive-next copied to clipboard

`drive.put(...)` should return the version at which the file was added

Open HDegroote opened this issue 2 years ago • 0 comments

Currently drive.put(...) resolves to undefined. This makes it tricky to know at which exact version a file was added to the drive. Returning the version or the node which was added would make this easy.

Illustration of current behaviour:

const Corestore = require('corestore')
const Hyperdrive = require('hyperdrive')
const ram = require('random-access-memory')

async function main () {
  const drive = new Hyperdrive(new Corestore(ram))

  const res = await drive.put('I add', 'something')
  console.log('res:', res) // res: undefined
}

main()

HDegroote avatar Mar 14 '23 09:03 HDegroote