Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file not available when writestream ends #11

Open
hackergrrl opened this issue Mar 29, 2016 · 3 comments
Open

file not available when writestream ends #11

hackergrrl opened this issue Mar 29, 2016 · 3 comments

Comments

@hackergrrl
Copy link
Contributor

File not found by the time the stream ends. (Using the cb param on createWriteStream works though)

var ws = store.createWriteStream({
  key: 'cookso'
})

ws.write('hello world\n')
ws.end(function () {
  var rs = store.createReadStream({
    key: 'cookso'
  })

  rs.pipe(process.stdout)
})
@daviddias
Copy link
Member

the streams gets buffered and then sent through js-ipfs-api, which causes your callback to fire while the request is being made, causing a racing condition with your read. Makes sense?

@dignifiedquire
Copy link
Member

This is the same issue we had with idb-blob-store. You can see a solution to this in idb-plus-blob-store.

@hackergrrl
Copy link
Contributor Author

@diasdavid: You mean go-ipfs is closing the stream before flushing? That HTTP request to go-ipfs shouldn't be closing until it's flushed it to disk.

@dignifiedquire: I think this might be something different? Do you have a write-up on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants