Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Files: add unlink files
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jorge Ludlow <gorka@aquigorka.com>
  • Loading branch information
AquiGorka committed Nov 22, 2017
1 parent 71faa92 commit acd355d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/core/components/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,5 +282,22 @@ module.exports = function files (self) {
},

lsPullStreamImmutable: _lsPullStreamImmutable
}
},

unlink: promisify((ipfsPath, callback) => {
const cid = new CID(ipfsPath)
self._ipldResolver.get(cid, (err, node) => {
if (err) {
return callback(err)
}
pull(
pull.values(node.value.links),
pull.drain(
link => self._ipldResolver.bs.delete(new CID(link.multihash)),
() => self._ipldResolver.bs.delete(cid, callback)
)
)
})
})

}

0 comments on commit acd355d

Please sign in to comment.