From 56df86afecb867d817b8fa36bd100f498f59a197 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 27 Nov 2019 14:29:00 +0000 Subject: [PATCH 1/2] test: pin.ls with multiple CIDs --- src/pin/ls.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pin/ls.js b/src/pin/ls.js index 1b93d53d..4d598281 100644 --- a/src/pin/ls.js +++ b/src/pin/ls.js @@ -140,5 +140,12 @@ module.exports = (createCommon, options) => { hash: fixtures.files[0].cid }]) }) + + it('should list pins for multiple CIDs', async () => { + const pinset = await ipfs.pin.ls([fixtures.files[0].cid, fixtures.files[1].cid]) + const cids = pinset.map(({ hash }) => hash) + expect(cids).to.include(fixtures.files[0].cid) + expect(cids).to.include(fixtures.files[1].cid) + }) }) } From b81f9ad6e797988086aaf6a14ea977ffecc3e2e6 Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 27 Nov 2019 14:33:47 +0000 Subject: [PATCH 2/2] docs: document pin.ls CID parameter properly --- SPEC/PIN.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SPEC/PIN.md b/SPEC/PIN.md index b83fc4a8..f8628a0a 100644 --- a/SPEC/PIN.md +++ b/SPEC/PIN.md @@ -48,11 +48,11 @@ A great source of [examples][] can be found in the tests for this API. > List all the objects pinned to local storage or under a specific hash. -##### `ipfs.pin.ls([hash], [options])` +##### `ipfs.pin.ls([cid], [options])` Where: -- `hash` is an IPFS multihash. +- `cid` - a [CID][cid] instance or CID as a string or an array of CIDs. - `options` is an object that can contain the following keys: - 'type' - Return also the type of pin (direct, indirect or recursive) @@ -107,3 +107,4 @@ console.log(pinset) A great source of [examples][] can be found in the tests for this API. [examples]: https://github.com/ipfs/interface-ipfs-core/blob/master/src/pin +[cid]: https://www.npmjs.com/package/cids