From c1534823102ed7bf10c243303cc8ae96116400f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Uhl=C3=AD=C5=99?= Date: Tue, 15 Oct 2019 17:20:45 +0200 Subject: [PATCH] feat: store blocks under multihash key Related to https://github.com/ipfs/js-ipfs/issues/2415 --- README.md | 6 +++--- src/files-regular/refs-local.js | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4e27f3db3..aa3abbb0e 100644 --- a/README.md +++ b/README.md @@ -236,9 +236,9 @@ const ipfs = ipfsClient({ - [`ipfs.refs(ipfsPath, [options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refs) - [`ipfs.refsReadableStream(ipfsPath, [options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refsreadablestream) - [`ipfs.refsPullStream(ipfsPath, [options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refspullstream) - - [`ipfs.refs.local([callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refslocal) - - [`ipfs.refs.localReadableStream([callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refslocalreadablestream) - - [`ipfs.refs.localPullStream([callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refslocalpullstream) + - [`ipfs.refs.local([options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refslocal) + - [`ipfs.refs.localReadableStream([options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refslocalreadablestream) + - [`ipfs.refs.localPullStream([options], [callback])`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/REFS.md#refslocalpullstream) #### Graph diff --git a/src/files-regular/refs-local.js b/src/files-regular/refs-local.js index efb8d32d2..50c31829c 100644 --- a/src/files-regular/refs-local.js +++ b/src/files-regular/refs-local.js @@ -9,10 +9,17 @@ module.exports = configure(({ ky }) => { return async function * refsLocal (options) { options = options || {} + const searchParams = new URLSearchParams() + + if (options.multihash !== undefined) { + searchParams.set('multihash', options.multihash) + } + const res = await ky.get('refs/local', { timeout: options.timeout, signal: options.signal, - headers: options.headers + headers: options.headers, + searchParams }) for await (const file of ndjson(toIterable(res.body))) {