# Promisify js-ipfs

**URL:** <https://discuss.ipfs.tech/t/promisify-js-ipfs/2385>\
**Category:** Help\
**Created:** [March 23, 2018, 3:29pm UTC](https://discuss.ipfs.tech/t/promisify-js-ipfs/2385 "2018-03-23T15:29:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![1c8c4309f496677c](https://avatars.discourse-cdn.com/v4/letter/1/dec6dc/32.png) [@1c8c4309f496677c](https://discuss.ipfs.tech/u/1c8c4309f496677c)\
**Post date:** [March 23, 2018, 3:29pm UTC](https://discuss.ipfs.tech/t/promisify-js-ipfs/2385/1 "2018-03-23T15:29:45Z")

</div>

I recently tried out js-ipfs, but the api was a bit unintuative to use.  
Maybe making js-ipfs a promised based modules would be better, or maybe there’s a reason to why it’s not promised based?

---

<div class="post-metadata">

**Author:** ![VictorBjelkholm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ipfs.tech/victorbjelkholm/32/10_2.png) [@VictorBjelkholm](https://discuss.ipfs.tech/u/VictorBjelkholm)\
**Post date:** [March 23, 2018, 5:20pm UTC](https://discuss.ipfs.tech/t/promisify-js-ipfs/2385/2 "2018-03-23T17:20:57Z")

</div>

Can you post a example of what you are trying to do and where it’s going wrong? js-ipfs should already support both callbacks and promises.

The following calls are doing the same things:

```javascript
// Callback API
ipfs.files.add(file, (err, res) => {
  if (err) throw err
  console.log(res)
})
// Promise API
ipfs.files.add(file).then((res) => {
  console.log(res)
}).catch((err) => {
  throw err
})

```
