{"_id":"ipfs-message-port-client","_rev":"306-ed127326798b80649be944494cbd25e5","name":"ipfs-message-port-client","dist-tags":{"latest":"0.15.1","next":"0.15.0-7b79c1b8"},"versions":{"0.0.0-dev":{"name":"ipfs-message-port-client","version":"0.0.0-dev","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"cids":"^0.8.0"},"devDependencies":{"ipfs-message-port-protocol":"~0.0.1","ipfs-message-port-server":"~0.0.1","ipld-dag-pb":"^0.19.0","ipfs":"^0.46.0","it-all":"^1.0.1","it-drain":"^1.0.1","aegir":"^22.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.136.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"contact@gozala.io"}],"_id":"ipfs-message-port-client@0.0.0-dev","_nodeVersion":"12.18.1","_npmVersion":"6.14.5","_npmUser":{"name":"gozala","email":"dev@gozala.io"},"dist":{"integrity":"sha512-dvbLDNv6ZcUJ8JKgt6MHcIP/jXbybFFzTn+kuvOQyp34kP5Ip91GWClLT8mKuoo1WWrlvyiJw1NzwEsGUlJuzA==","shasum":"6bbb9371b8070fd033521a58243389e671f6e5a9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.0.0-dev.tgz","fileCount":10,"unpackedSize":8572447,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfD2LxCRA9TVsSAnZWagAAEHIP/AvCuKJ+BCSIRUTl7KlN\nrhEn3nHFlu9zzCefdGhbXz99Tjvms8ATK3qoZvdo30LjbcIutnultLishams\nc5s2HCoFclthHOdO7Hp7PybgNatZd5TnCA5Se8T0uHdXIPBlyGsemwXH6ueC\ngEtotvOUHH93Z5d61J2Vlo3qSp9Bs0PydhEi8IfQGydQuxNbYYsIKruF9ORC\noPW/5Q9qgo+SIvakilKi7h65E88ISLueTCB0/AQcrm6zlF82mLKy3qY64IUs\nw3r9fsrQfXRm8h+zgghfnQgT5FmzhimhpTPPWtHO1fbeZ+bIRLl3PG2yCTq1\n0+gS9tFG+zBkuFxxxCXNipId2YbmD3Pr02WjnravVTfQbaFVUcOlz55dNPlb\nv+3ozzV8tW8MsVYNsaz6Pv05Jubvtqoo7XUfl+lyN1s6D2m49vmp8m5XYNx0\n8y5ivjlXr+7Tq7WawvVoEIfTJUkOisClr+mUzTkiUw1vp1hbgDFfgt/V/S2D\nmXxlJb0Wl7ITbBVKs5aSHLcupY8q9xPeAk8hWo/7VFuyWXjLNcfCWitbZR97\nhswkZKIAM3BCESuZrwTry+hIXFL24wO8Qhw4jlLgh9qCKEuqBox0Em9S0EpQ\nZ+LYG7kHOQNZvzGC9Hc7uH7IMVKuM8WWwck/5XGw15rIoTZfWLypVoiGsvwj\nLcOb\r\n=fNB0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCBzs8jcwUy2M+kG02YQQnCppMYAJfItC2y3INUgokE1QIhAMdqelDdddbr3cpt9xNSnc0YvEACnR12IsCeeLy5Tdeh"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.0.0-dev_1594843888928_0.2050356842563157"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.0":{"name":"ipfs-message-port-client","version":"0.1.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.1","cids":"^0.8.3"},"devDependencies":{"aegir":"^23.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.0","ipfs":"^0.49.0","ipfs-message-port-protocol":"^0.1.0","ipfs-message-port-server":"^0.1.0","ipld-dag-pb":"^0.19.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"e7396bc883ad5a6620e2f7bc32e7baf4e636e230","_id":"ipfs-message-port-client@0.1.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.1","dist":{"integrity":"sha512-tXWK05k8hnnCJVnvSAqri5ZOgwSyuoVd4l5xFkJyIg2qqfGxz12PHSYQCLg0tDwRP3y5mv/dQDSTC1upw8qjVg==","shasum":"1bed748b64861515ad73ce9a24687da8e3dc01b0","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.0.tgz","fileCount":9,"unpackedSize":44176,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfM8l5CRA9TVsSAnZWagAABMAQAIu3j58Eoz0tNdnGSh74\nQ1KG4uCAbms29frlysRbTbpo0U5ukZuC3HfIF/bHXIcxYcF1J2oLSabNaRGn\n3zw1l4/0cECO61wCHV9devPMT4Fa4GxwCtni0LnH8zRsGAs/0cmIJJhM+zJU\n5q2iuYJM+RWuPgoPbtuLeYztCHwXXaAs/aYbX9tyhPkXDtHyDdQBX+eefett\nxJxP8uDlNbdo8dgiYzEVnJJphALfD5yFYM7KQADZHFYYHPbZlbq9MdSe84cf\nKNmitSW55Tbo2EyXbbsSMGgIv1VHydlCVX3DPI88AVJVoyTLO59affwDhfJn\n54k98yBxo31+ZZ4FMg7Rlmdig1V2RrndV0OCpehksKYmpaaULTgaGoXvMJqB\nbLBNtIXSQfvYDCKnmocda7C/lvUGucNdsa4t7kaJPEOUNwScDktN7wWiPl7I\n4DrqUMMqdemRGAixnzzyvRfP7HSkjWixnvNZ6bltWUnipYs2aWZVzg6SPE/7\nP5DcA6gUvramTqNKIELKjni/pCRd11uaVTI6+/RaIXg2q+HrlMFRjZkMsD4X\nBVdOW1RWFS3yOTxJ+ysRi2mmq38L+3Pnu3m9vDXv6e3Jlwc91gXvM0/1cJWK\n61JVFAtZiwRM4dioflS08T+vblkl0rNdR5POEUXrY5dWxFL1LDKxGxX+jkFQ\n7Lty\r\n=4ceK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBcbMd+fWUxazaWQmswp00ZNxslBYbSRVPxLEP30m0BwIgdEeT/6WM26dipNdAtAU/j9StFPg8otIHUwYxYPw30Sw="}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.0_1597229432879_0.8595445839883036"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.1-rc.2":{"name":"ipfs-message-port-client","version":"0.1.1-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.1","cids":"^0.8.3"},"devDependencies":{"aegir":"^23.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.1-rc.2+5cc0e086","ipfs":"^0.49.1-rc.2+5cc0e086","ipfs-message-port-protocol":"^0.1.1-rc.2+5cc0e086","ipfs-message-port-server":"^0.1.1-rc.2+5cc0e086","ipld-dag-pb":"^0.19.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"5cc0e086b036e7ba40b09768b67b7067adca43c1","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.1.1-rc.2","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-qxWycZmIUYK6yZhBTc4CvCGMfDQrnMDuFCvqsKVpLx5x4/OngDZdSHCBv1Ng55uk+qmPyxnORFPp4MFTWqrCVA==","shasum":"4ddba9de50f2ab7cfc183ee5fc34bf9e830f4dd5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.1-rc.2.tgz","fileCount":11,"unpackedSize":109599,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfO/swCRA9TVsSAnZWagAAGggQAII7719zPcktYU7/xeQn\nnPLGYPA4Uz7qEmdHXH5kOHgElEB3vMiOhOcn8CzzSUSxmMU8Z7S/aqnPFrlV\nnBGFhiN+kFUSg4UCdnfl93wIBXXN7RcNz6Qe3HB35c5kEyCxniVeVExqXSHc\ni9BFfK8W0ARBBOdIc3CSfNa9QHr9WcRKyaQBEI06tXovT8wTa54jyNllF0oI\nJqcrLxgZrfle+jnhA0Dsqi7Nv+/CE3CNZ5FVsqtPHinwHMWR6th8tvLs4YrJ\nfV91vEDC/IMtwJtvXD1LVCF3A0/2fTDnkeAHqfoW7FzyadzvPOmADIMxhXu2\nv1kQA+9qeei7hOrQXX+vFnaTsDp2j9HqsF61p7evVee0ESBJLRJBRJnYsg0p\nJKtFvkb90yrshGC0jBmSqi2CTe+4kYv69cPL/u2BKxf7uhEmC4OsJo7sIVx+\nB4fJ2XgZkz73MkCHi+fHR+mdbVE6ucrBSsolsMN7fjOKRSktph1LJmZw4TBi\nl5UR2FsR2tOmRXF3g0h/NUWPyI+NWM+/ujMf7lNpixer0a8SGznrIwUXl1ay\n94ohMKeX8HlSBbaKnCxhCPoO6mCH74p1tU4QU4dg3+cXq4Bk6AUMP2zenAV1\nzZ6PjM/p78TfwZqeiWbZm8v4P9O0qY/rTXt7NKFhmuQeE+hr4+8py8nc4vJF\nvn0C\r\n=bWwN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDPJM7LoJRERdh3nj0quOUgij6ROTkXUH+bECd2oolE5gIgRixAy2Vy6XLLqhevZFhvm0/y8h+PpP1nyyoGV/E2aIc="}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.1-rc.2_1597766447625_0.27195554285682433"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.1":{"name":"ipfs-message-port-client","version":"0.1.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.1","cids":"^0.8.3"},"devDependencies":{"aegir":"^23.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.1","ipfs":"^0.49.1","ipfs-message-port-protocol":"^0.1.1","ipfs-message-port-server":"^0.1.1","ipld-dag-pb":"^0.19.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"84cfa553ffc717d5d8bf94fdf6a306f182c9aee4","_id":"ipfs-message-port-client@0.1.1","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-EekGRbrg4PYiweoGxXExnJK34OjGNkq5BR2mqqgwOafOfdDLD8qKLAzhqWHNqGjyVGoCGe0G7BeqadmTX3JVTg==","shasum":"0a080d2a2a5c88fdc8b8e1b7cc06858e9c369cc4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.1.tgz","fileCount":9,"unpackedSize":44376,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQ/GmCRA9TVsSAnZWagAApIsQAITo4ZPOkDAjdw8KuL6n\n9OkOxUJ2ZeMSHvM+D7GCL1q2TbHD20cNBzHbSgwWayAbGkUDD3CJO4TMJSg1\noeXtCR623Afnt4uOAmowonjX5SyqUfALDFZmpXIzjiFnYJ2X6YPHADxUF0qF\nzhVD+RTSimaNtW2CZLXVykz8BLA2CUUwNaAxLhuLm5UPQj5gSC4mY6L9rlkH\nefAHxyOejYoVPy8Cj4k9MbvltoF0ehZvRGS7Nj64lPSt6KI1gsxO//F2MBql\nzPOVbiQ2Gkc+EkowirQg1xPyAqsvZQhXZy1/4L3+t8AgAclO67xG1rzsFIzQ\n2wesLppNPNshdB4Fz1Cdruv8DRJXPQzu0w1REIme0ZjjJRniMqfXhNoFj/9L\nnH8C6l6hgBrji6MGnwH5h9bM5gyRHBr8tdFeGq7FS/B9VLETADeO9BYxO2zq\nYKdFHt+3iQT3FmuuT4sv7rutb0cAKoHcA2X6W6jUjoT33nMwRYtxxs3EmWaz\nsD2RZu7l3E9i9x53slt5OuoNlVT4RQJ90LYKmyFUo3zVlNn+heEep56l+wKX\nm0Ju63Az+agY20iTfqSLPb61xV01b85kMAaxBAwnkgvSIn0UmVnVMpkDHs8C\nj5cJWL+dwF/ftvqsEDLDQbm17yBparnDZoZexM9R8IR2+ln1/t2uL748RiKJ\n0Oax\r\n=sl4S\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGB+2Cu94WEGm4Y7oIs1ArYMK/Ayb+pC+qBKS+JKCfHEAiAoTUZnxes8hiYyOB3q7gScrOzsnUQYTBWM2UmA5YFUKg=="}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.1_1598288294407_0.7358338355226886"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.2-rc.0":{"name":"ipfs-message-port-client","version":"0.1.2-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.2-rc.0+64b7fe41","ipfs":"^0.49.2-rc.0+64b7fe41","ipfs-message-port-protocol":"^0.1.2-rc.0+64b7fe41","ipfs-message-port-server":"^0.1.2-rc.0+64b7fe41","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"64b7fe41738cbe96d5a9075f0c01156c6f889c40","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.1.2-rc.0","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-iHvAXSzLEO94W4eOaAEYJnfURzGejbTogllDv8Hjot52vb5ZvFA1P9OPsMHm2HYw3Ex3Y0deOAfrDukTRA6rmw==","shasum":"515fbc0a233c4bd35ddc481d89d099aa846a6b5f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.2-rc.0.tgz","fileCount":11,"unpackedSize":112070,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRLnRCRA9TVsSAnZWagAAL1QP/3IT1XMbRwb3qMY1NySI\nUvjuNo4jxa29iEeMRJUeeuD9C+mwqs9hR4UD4HHUG12IpZxTvMsNedXtuJc5\ncV5ZJ3D4OBtAgqetBK3rwMFCT7x8Zoxn/AUP0So7XIN9BhptwoZZyrMSXUVV\nISJhPElOm3AQ/QA92D5Aa+TcSiE/YXJF94ezWZlh7GXwBpHNKBMpPgn8X3GJ\nEW1RGeDjJwx/d4EYhx4Uo++BF0RaWhRnwlizW4p0bNKksgFBv3A1fEkiwTkS\nvafqx8Vp1fzExgEuYGHCwftaqDDvh5VsulubLOsOKSun2zCmDQ5NWCrvibmO\njBRjdVEK4PJlL88w1h8SPNRPYKBQzMTdn7jGDI1RuXlNO7g0l5H7X0kC7Vst\nCBBBc3TviDFc7ClmRKG4lfp+ffSHpKrtaYxDK3Rkw4B6Mxj1mXWkgFzVFGRV\nlpqYkpvDOGy4uhb4sGuHaULkRy0KoFD12hGl/1YTXa3sRwmx5xGsz1x2em7Z\nQS5u1V0gVH89ray3wT8n5kf0NbG/eRLG/cgeJpIo/NPVm14wbeMaTCL4Y22O\nNWvgf4spDO6ewo6bW2IIdcSKjYEB04nBBMXwPkOHpuXuCpf5lfAuMZD46zW6\nlepZLANzFhhNZjeHX36DJEM5+my7pZWpzGrL6OcOXjroyLAenFF+hX9+fsCx\nw4g+\r\n=K6JC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGci8rDQWLis5sIifKtBJBCbvxP+Ao5IW2SUmVP7VI82AiAHEkIoCUR4Ef1ZIzYjV1GAzTyjR3THqh5vEvFVUgcq6Q=="}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.2-rc.0_1598339537264_0.9208791542246548"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.2-rc.4":{"name":"ipfs-message-port-client","version":"0.1.2-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.1","ipfs":"^0.49.2-rc.4+63d4d353","ipfs-message-port-protocol":"^0.1.1","ipfs-message-port-server":"^0.1.2-rc.4+63d4d353","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"63d4d353c606e4fd487811d8a0014bb2173f11be","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.1.2-rc.4","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-/exW/+wa2L0GQcGNOX+qxEhPvxGnCW7BUqTSIu+izREthhLP3PrzvPpsCewOW6pqjq9RD+HHCSxM2Dy6+LHN+Q==","shasum":"5c1248ed6c331792cb1eba4e6e64af2133879984","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.2-rc.4.tgz","fileCount":11,"unpackedSize":112042,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfR+iJCRA9TVsSAnZWagAAkRQQAJp5WUUon/ousDjAfvwU\nhSXSRj3GWrxGa71OhQ6TmE4Roq6AXogI4cRxPAM788P9XChyTIDTWUzFMUzD\neMkh5aT3qlNQ2+Y2zcv6d8slSqLp/McY8XCxZan+4BWupNmD8XWOvXuQZCrM\nHNjawq2Pe8Xa/i2NRmK+wXVxye6OCt06n52FbnK5TuizHtReWsZqIkLsXbKs\nMvbyn78PxX6Lb2uF7uj8lRsb7tiu6ashIAk69k95vNN6GHFE6MDOOPwjtdv1\noYQQ+HfckfLe6WRvo597bcqOzfOzyVEY7XHzPzjtoWB9GB74wLb9gTIn4Fns\nQghqrpmT/cQlHoEC8c+IEV2xnfEvfbjBDtkMsfjvrn0fB2HFe/8+zg0UV6x5\nSn2M8o6BPoq09r/j8Nkj2w7Oh3K/J7mhXUUbz1Xkc1v0VvCx3R4mE+nDxcem\ndh8AnCKvNagOpIxnyR/TQ414qhFQFlZ+fHNV0x2+rD32DeWWaIpWYy17hp9A\nv5lt4A/YfV3MZ2N2uxAO8xPyi9ZigvnYi0BmUvJQJGgj6fuGAzaN7/tEEBEA\nKtXvBvDkkRzqJe0PHKugS5liXTkIaSvVCLq+117ylDIJTppBzTIWQhYc+5I4\nA5/vvhJ/r55cjM/+/fCbJT1XxGkvJEukqBgVxb5A5AuxYQtyboxTSmStI8CD\nje70\r\n=dxrT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGsFbWN5LrtSRy2jwnqCJLCQs/W3NMCha7j0hUdcXlSMAiB1i//raLGgMcXovYIHlcFNj+1E8+cTKS+7nyYq9OsUUw=="}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.2-rc.4_1598548105041_0.8561840338673239"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.2-rc.3":{"name":"ipfs-message-port-client","version":"0.1.2-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.2-rc.3+997508d5","ipfs":"^0.49.2-rc.3+997508d5","ipfs-message-port-protocol":"^0.1.2-rc.3+997508d5","ipfs-message-port-server":"^0.1.2-rc.3+997508d5","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"997508d5674631f63aff9a3c0295e57510363080","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.1.2-rc.3","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-nJJht8KVpBz+noVSAhMxSn4WE2eZN+InlUrpUcHON7uMHdwj3kGWxqa9mVC39gjVOLMxSibecTe5UiyD2aysBQ==","shasum":"d2ad2561ca2aaa56d5162d3b05207c91a0cef4e5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.2-rc.3.tgz","fileCount":11,"unpackedSize":112070,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfR+0iCRA9TVsSAnZWagAA8hEP+QHhKyt0GD97pvo0jVqU\nN6ZNGpQx0c1IMk1MNdEbP3c64WqM0pkLT6tkNr0PU0ikslk8MXj4dRHXxyqp\niLqGWozZwKuygvJBulX4bWyqsiuGjh/0JdbP4T8K1jLaoCtx94JtLw+nGo4j\nkSWYFuMhAcfFslGMxe954Qco7zvv9O9vb2caEbi94lEh9gQNDvRQbgfO6q1/\nIGMc1rmTcz50KFroDKw0JQEf1ex2PZBLA0grElaadFMepMQuIx3Lvp90TpRe\nBwSsGXJuOc5BPTyN2kfSxpOneVfvsPwSeLFRf2bgNiPkTJ41VJCCnbrHdVvm\n9fJHvbbqUc/Q0AI6EtbEgT0dqS5OtwFldCuV6M4NMPaicL1XOwUrobV79+rF\n/R/4kxLwRIlZkZR8Skc0AZ+3ZWSG0NI83xY7qYpWXDbpoYtslHVDk4KzyF9j\nNRDR7e3f7+DvSYV7EQ4FnjxglMoomaV24Ud/dWXREB92JLvEJp0NKdaHFOjE\nALUe+8JAtMXHcYH0Su5shMo3pe/CD/l/JSJq6ijTluoGAVUvqRRh3yzq6Ey3\nRVd/IBL4bo7qMSpCNo3To06obsfctyg0YwCoJrCcmhlZEd2Kicn6a5NVVhAO\njjpYKd1Cs76RI1l9VUBBJUCXjoKZHfemXf4FzYTAzMFQujuLgdnFjPMfPEiU\n2M5s\r\n=rS3L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCm0CiXS+a2dfERc/Tr4EOdMvqgRPNGR/Mfjs5Kw8tE6QIgLBT/M2mUMVg4fiDMibXYUlnFaRluVpFEZwMBZacPGkI="}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.2-rc.3_1598549281950_0.350358992586427"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.2-rc.5":{"name":"ipfs-message-port-client","version":"0.1.2-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.2-rc.5+1b6cf600","ipfs":"^0.49.2-rc.5+1b6cf600","ipfs-message-port-protocol":"^0.1.2-rc.5+1b6cf600","ipfs-message-port-server":"^0.1.2-rc.5+1b6cf600","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"1b6cf600a6b1348199457ca1fe6f314b6eff8c46","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.1.2-rc.5","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-ZuDdYhP8zsbd5dQYIKzLUdrq0lP7OmMZhOsr2TLAPCGsiGlN31l3vS2JNUoYSr857ilvDC2r0fj/yZBQXIdvcQ==","shasum":"946e3dd5d0f68204e9839456486101ef95ef64ec","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.2-rc.5.tgz","fileCount":11,"unpackedSize":112109,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfT33qCRA9TVsSAnZWagAAtnsP/2VluOgFRpreYdLaI6pY\nQJHH485YDEuOitGlkJyFsh0VHfJM3Af5Ec4vUKwTCUGsPFfVmOZmlzb+KWFr\nlVVUeAf1905/CHqiH8ik3+ExPh+MC5RjINMYtTDHvMBYkmjen76XjRuK0siQ\nE3ur04rFC2pi5DqldrgSIV7m7zcYfyz1rkQZSTriCDnHszsMICgiROVMdQVO\nka7M96Mb62OIRXVynCzP0x+2/GqA99jq6mgIzwlqIJfRrFzo6u5BflPBWVnw\nXSOwFGBq9DT8SzfnoZ4TQypuxG2gzlb+iQaSRPIzj1z2w1QAvWLIVwJH5jY/\n15C8iU94j4ZQvOsM0JBEc8PE/7EjtvbZfbIeIBzm8nhZKwWalBS+y375b3dw\nWog9bTatxzewfQFfuW4L8xBWln1ZPAn9tPdM+rxODijEKFtrzTHui8aISLXi\nyK9zDpjbq6oSpjqpfpR3+yO/kvSf63QOHWd/MmpFYsp00SVZAA4Dj5qbLZz7\nKH1TKHv5dzokDGTDbce6r1WUnl16T4uh5nbGclpbmITE7YuIu0w57aA2eXmo\n8LQZ7oCxwskL/ocYFan3LW+sKly9wKptl+SZfzQeILiWWg7lcjc60IpLlQKO\nFGMuN6aIxywQqE7LkbbyLvpcjOr5bStnPYD/dw0rg6LuCljkpHK7DeyJ6Adq\ncjmz\r\n=1gdh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgKVVU0U+1qNEpiezfclOtQ3+ldpaO/Lc1n1TdZO/ViQIhAK6qNuVD11TFdTIiLlt7yoYNaO8n41MklkIgoSxW1iPY"}]},"maintainers":[{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.2-rc.5_1599045097465_0.4788638833515184"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.1.2-rc.12":{"name":"ipfs-message-port-client","version":"0.1.2-rc.12","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.139.1","ipfs":"^0.49.2-rc.12+6816bc64","ipfs-message-port-protocol":"^0.1.1","ipfs-message-port-server":"^0.1.2-rc.12+6816bc64","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6816bc64ccb9bf852c2b9a26d9ddd19b9439dae6","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.1.2-rc.12","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-OJ+XJ/DjHUFHm8akG0MT+NWASJWOtMjHeB/v4VaGYEe1oL8G4L7wpC51vfyBHAfPLSUBPgmYXZg7GUEc0Z7L8Q==","shasum":"f57fa5d63fa5399d55c44d4a4222df38ed5c65d0","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.1.2-rc.12.tgz","fileCount":11,"unpackedSize":112084,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUOiqCRA9TVsSAnZWagAAcyMP/3h9EWsAHYwlb60zoBjH\n2LNauoW9FGWv+vYRNT62rY0SWmqFkNoGhe1mS75YtegPwPBdwRBENmuGl3nQ\nFgAlcmjN4DxZAy5nXQARqOKXQaW2ihjzcFx3NxNxtYNgd8AlfvTvhZIph0Cy\nCSyODqNj5+QF1e3sQo0oPj592ndFXBuKvGBdP1bo+BHnKvUjkZNylmHkJUkV\nsq20NZ1A+6FA/sAN/IfRNGaNLnrEhJBujb5cezmdWDX/BV4FRr+o3DvEovKx\nqT2EXQ/tzePJe29uR5AOiYgE9ggzZkOpfpv+eqX9/jmcgmVvPiubZEYijmtK\n0i+LeLnG3aInNi73Vqin5baCNnLMjchFu0hPFYbzcRTJ49QV6WDKiri8EY8G\nROmf80GcF4V9LUP1x7j8xk3AfLX4BFxG0WtZirPxDA/v1Xo52Eee/xnyAy/n\nbC+5b0GLfaVcb771pe7sbNx/zSHD3qDqI4IWTtrA9W9GtkRDeJ3FqdyG72ru\nGt2mZxmuYsRHgrwUO0D8mCWfVbCkDdAL7wTlgfvQ35+gva3i6QeQygCJeti6\nuYX3S5B50dz/dCeWgK5712D0U8KoKnFDR8nHph1Fcje8RtU44k182cPeRC3H\nYIK1MNZgSOhLNoEoUAGS8AOupu+RSe81Shh1531GWPaqZHZLyOEFaS9ovvZI\nxh44\r\n=En3P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHX4nSOFEr5SkQ1e/lRoJoymYtRlT8LortsOf+eRjAJiAiEArq/mpGc/+KYcSbPlIKdZlp7kWEwImPNuujuV/d8r36A="}]},"maintainers":[{"email":"alex@achingbrain.net","name":"achingbrain"},{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.1.2-rc.12_1599137961757_0.25732933297499083"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.0":{"name":"ipfs-message-port-client","version":"0.2.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.0","ipfs":"^0.50.0","ipfs-message-port-protocol":"^0.2.0","ipfs-message-port-server":"^0.2.0","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"5ea027cc1d92148210e4c42d56b583078cddefa0","_id":"ipfs-message-port-client@0.2.0","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-uwCDgKhOXeL52ziYDOJYmxBCDJi/PK/713ii0wTxgzhheteiyWA8WcV/9/kQ+E3O1nGq33yrj1g1PTyBdYX/TQ==","shasum":"a8d4154ab38a65e0ef80b7de7a9a3b3ffb4b2631","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.0.tgz","fileCount":9,"unpackedSize":44779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUPs6CRA9TVsSAnZWagAA15UP/1rnh2sgXAgXSnEO7jeS\ngozfd8FGqKufRmLCMKOhKPlFlwCT9mnhsSIUmhKnYcPyRxO0RKXxl6gMhHzx\nIcbpZD7BIJ8vMaRfTmEwUaQQpDgncB7AbSRQ+Axd43xyS3CaoQTupu2qi+20\nPrh9UfXU4lWMeuHkkeEzYmg2RL+/iO2jN4Q4jtxZTEgzkp+h1rwcpIKEjqA+\nsVB4sfn9IdLhM+5VzY9J4YvOca7EoEHI01eUglU6SR7nTOArFGcBmU/3JNnQ\nikgha77BgmSpROMApnBj8smsBBqNHJDr6HAzCo2ugwc00oltkH2EPzIrxQzI\nymO/dvaxsgoa/HUja70n3Wzk5VnvYnou45CltiyzlVaMUgogGs8lGE8zsTXl\nS00G4XiKgEGAt0aYqMdlF9rK/d/TZP77ME88h4Azj51ixxHS68U/TnlHnJBx\nYH61hY4VXUctZwTOr6fyBMkQCeM+e/EfDVBpz6dchJkW/NKhLhl5/UC3N5ER\ncX6AxT9T3WGRJ1uhni2IoJAamgMBjEo50S9LSwHVzR02icWrGR6xv+/GSsoF\ncDxhY0E9GcZvKL2P3tSVzAbCnG4xFl3TiPO9hRNWMx3RAu0BnLCmH6uqCgS3\nhsGwvF4f4z74AzCqT792xyyLMRqbuum9/lOcWsQI28zdzzDOPtsZNnq67eCj\n9sdy\r\n=Y2XC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1lT8DYDGbjf+NKXksrRT+Zul/wGdlJgYkH/Sl9BCsQQIgcXRN9sKS9Ti+4KugNuBdvNYF/VhvbaxsRxEmFocPVp0="}]},"maintainers":[{"email":"alex@achingbrain.net","name":"achingbrain"},{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.0_1599142714247_0.8771690609215437"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.1-rc.25":{"name":"ipfs-message-port-client","version":"0.2.1-rc.25","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.25+6b7796af","ipfs":"^0.50.1-rc.25+6b7796af","ipfs-message-port-protocol":"^0.2.1-rc.25+6b7796af","ipfs-message-port-server":"^0.2.1-rc.25+6b7796af","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6b7796afb534876d7e529788b604b120d4114f25","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.1-rc.25","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-r28OBUm0XZVa+8t7WkT+Np2SkLkSEVxSomK9UcU24LVxVh4B4Qg5v10M6zRCpi1/LP/J4Cb9f1ExHQiV9RdIyw==","shasum":"c7abd0a871d57eb046b2c294efc3b82be53a38b4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.1-rc.25.tgz","fileCount":9,"unpackedSize":44854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUk7NCRA9TVsSAnZWagAAvfkP/1C7Bp5yo7XE0HGRD8Ff\nGOMvWvr6hswxsYE2H5oHOClQcHYTGid2kmNk16WJfUMAFiT8MuJqGgq2BxTm\nx4c7JmFwTa5H2a3jKGA2Jvys4Khe9+sKDDbeJOgcAJ8PR34lqXnPQ18SAoAd\nAdJ9RWDPq/NeXE9exxwgs39N4R0b//rIM1SoIOTX/hCBZBuRSsZ6g+9Syl+3\neoA2HqIn2jAzshnW2pN7f++Z2z4edD+4PcNoUJYTX9EqC/8GsCqq59lstQK/\nxQEwjQIH46QPNFCI9xfjouhIp0ODz+WN8xrfqhEMtN3OrbxShimpzCf0bYLj\n+SNngTXNwrDweu//ax+LH/yCR5otL0XpK4vpAfvWKbi1RKFh9spKxHiGsd8B\nZtQebw8nxKeN/s6ZW7uuglHMyUP+3vVH3sOERSApPtZrDLg77kfVESSAm05m\nw/DFv31/vaf0l69Ul0t57klyBGlGnxvXLfsiSgVAvomLX2O93xtWZL1OgD5B\nMewPYW26rofrobDCvG/D4Jt6mn5cgoXrx/DjqHA29n8uAV1kIipmZ/ZTBmxf\nl+jTaFJ3FAOyA5n4uYIH6eoRsH29mGqTikk7GLuP2TSnV8JpyKsnbA5yKJzP\nkg75GlPojzSBERjjRMJbm9YoAIGuI+9g3V7g8nKMJWDu1KFuGGIMI0nhl1tz\nzQsW\r\n=x4P3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKC/Kmk3WnzOzn5t/PH8PAlcqUKnaHODoCr2n9qN3S0QIhAK2hLwSZugTB/l6dyHvf3TLZlBAKRtPFSS04njdOXP65"}]},"maintainers":[{"email":"alex@achingbrain.net","name":"achingbrain"},{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.1-rc.25_1599229644515_0.3832088598894381"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.1":{"name":"ipfs-message-port-client","version":"0.2.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.0","ipfs":"^0.50.1","ipfs-message-port-protocol":"^0.2.0","ipfs-message-port-server":"^0.2.1","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"67d048216ca391b9d9020dab35ffe7a46062b93c","_id":"ipfs-message-port-client@0.2.1","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-+U6bjfEVviBjFb2xqZVrOu6lPLJeJjEsJTaQQwOet1tdsIiwWG/q7ZUNZM5TJU8Nsgr8QxgvNqMKa8GfEktJtQ==","shasum":"c876c221ab882ad12e9263f2b6019174387b5a17","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.1.tgz","fileCount":11,"unpackedSize":112579,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUldzCRA9TVsSAnZWagAA2SMP/RObup0umxs6v7TxfIbr\ncC03avoScwGn85ZPbg5RqZ3CY6YM6Pdjz86PKRjhT6mkkAePqeakDoao67Oq\nEyTh4XR+OqxKvFcMuEnYqiEytr1V9fhAelp+ObHw2yvGJXqWD3840GLYmHDG\npKj4fha7dEQFUdRWZfXvr/0o8VEBJqIjq5vFeEDo6/sBLxlHBMzJgdYiRK6y\nOZoIoaHzA8zK7ffs37f9ytWtZ1XUfUHF0NN5DZmnbQfLQxrqV5Bz40bYelUy\nCFiB2Z8AIVfY36/Us4H3X5gOnCDVCoYTIZrL+oTwYn7FUhYpbL9ISYsFn0Vs\n2fjcaB7BROMvMW+vGD5AzcicXxG1SNPlVCu8wG8PM0MpP/+ccEOXfFZ1OOcd\nkypSDI2x/P9jrM3J1HThOFEiBN4Xq1qdc4x/a3SlMM6/yd7TAUnxFx1iFymL\nFOLVbN0n05PgfBYaIruabyES6hVFQOMTnZYbq0uGhIPex1At123xstDkuk8j\nAGGTzjvO4D2v7e8hvoFrszhS/6s7ycUQHg57kCuHGz3Jo2wbyR/NtyNLl9zA\nmtwQ24AADyxbN5+VHEDbS0/eKnBDFS6YjXVwMyfn0X8ghqrosbeT8HPPnn5r\niEfQ7+RQzUhQInKijIU4tGODasz6vE1Lk96PTKo+LLH/mymWniurR7s1dGvV\nbeIe\r\n=CaCU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDpXIxpDc/fVmDnQay59yHI/LM5dwy85Enq9UBU0/GaVwIgDUQoH+1yhrEhbvARHd8OAfZpfWrvmA/syg9MwsOO1T8="}]},"maintainers":[{"email":"alex@achingbrain.net","name":"achingbrain"},{"email":"dev@gozala.io","name":"gozala"},{"email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai","name":"ipfs-npm-publisher-bot"}],"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.1_1599231859362_0.6671765993362175"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.2-rc.2":{"name":"ipfs-message-port-client","version":"0.2.2-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.31+d68bf64b","ipfs":"^0.50.2-rc.2+d68bf64b","ipfs-message-port-protocol":"^0.2.1-rc.31+d68bf64b","ipfs-message-port-server":"^0.2.2-rc.2+d68bf64b","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"d68bf64b6340750779fdce1e3ca47e8d6fdf8a16","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.2-rc.2","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-xAQ59Ouxmqueqj9W6VrXljN3O1Gde8lYxtvd6u2fZS2wGhOfb4H/FM/i50R0mnNGlnzCY55m9TAagn4sqCR2hA==","shasum":"52812aa566dad8c1abbdc0fb6a4c455588bf6b98","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.2-rc.2.tgz","fileCount":11,"unpackedSize":112571,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWMFcCRA9TVsSAnZWagAAkbAP/i8ABFsmcbMQkJj4RdlC\nThV9YFLGoouigasvlr8yNgr37IMFDdPiAMpTH6IV0o3Csmwo6q7mcnpRwI8E\nh+7ULVEgGjuudrCXgtsS7naGP95LTgoc0642txLwP2FoH7MKf/kABVCBjFtm\nU1WN5+oiLJAzCNmQtQShnJGOqzHjZfTD9VrfxnVmdSuAFM+ebBm1ZaWZYqwy\nw6Xd8BqvoUWXLodIrHzrQDYX4mIR7pKM+1PYcR1ovR6TzP/tTsW3iU9JMKHz\n+uw/twqhojJRLgszk+s5GnPm2d9tJALeMymPRP8jLXY/obMtqjjTckgQj0Re\ndrz/8GqjtwxnADHMIs/2H0rBBzrwv3w3WLjuUsR8zGZeHyZFjmw6h4GCGzOF\njYnqt5nuqoYzyMT/hik4n8qbi9FJ5wez67l9Mn3REB7q9Vpi+5/x24Ny3CrU\nncg9/G0eGDNTlcHn1PyUOynTmfiEdZUrQWhGNFUAvH0Cw4xnY5LCyWKtWfZY\nTsB6/g2QDDn3gFRjKrTSleEKkk0o+abu8dH6f71PNYvBAKvEtwsLezplPs4K\nTnSVgublK47OkKWfQqYVHiLRuwmUI2BcyS69JZDPit/a7LogrVdfbsH2oLWI\npPkN228iE3Jkl/zIyl2nvhN3tRpLlTD91mrL84kH82F9R1f8FEqonbpaadjY\nE6GU\r\n=QeKg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA+ETSexcID+rlkE8myf5nppBGG8LSXjx/VM+6+4GrUhAiEA6jtWq0h6VpZ/KfNsS782S55FH/89QWuKJ2lLFBcE7yU="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.2-rc.2_1599652188277_0.6483226775525688"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.2":{"name":"ipfs-message-port-client","version":"0.2.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.0","ipfs":"^0.50.2","ipfs-message-port-protocol":"^0.2.0","ipfs-message-port-server":"^0.2.2","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"99c762ba6b3b71e07596b2930c09fb143451aafe","_id":"ipfs-message-port-client@0.2.2","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-F+ufD0SsycvR4BRQk3bhQ6A2fNXTOnUOmXwm6lsEGf1KgRzrJcoAL6kgtQHzYSWRigG4q8XDUTPkdWKAY6Iw7A==","shasum":"c677483478b977974a4812c385df70f6f06c60c9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.2.tgz","fileCount":11,"unpackedSize":112699,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWOYZCRA9TVsSAnZWagAAcdIP/3Q1LF9oaSuW2345KzcY\n4sJMCSTFDIEq3wnn//QLjY39mW1A7lgbGkZ8J2TYESVTYS9fJ8t7xraNES+P\nT6VYwkwTP75iT6woRxCksLeTtNI4hYaiCgSrXJjxXjA0qvmDa8FOsNv8tPjC\nvdQ2BcivdxOq1Qxb/VWEwbZPswTJIjtthoxRmCy+5JVj/1bddQKRzW4i785v\n9fr4lJNnEyRDhTnxJrUQV+ElKSmg6eoFgaAGqzWEsXUdhAAkXpM9Qm2/YDjH\nXDk4SSOvgoOhOHMnqzR7FBTU7SF9Y0mX1NLGeb4BXOJgQjPtX4QtGlEVe8DC\ndJuba+wH5wkZbAgJIIWOco/kbw/oGLWtDvHn/94SVHba+zgUZco3jU4RaY0m\nVNV3L99spHjkIZC3f3IlfSNpLeHKkkkVQY/V3SFI40pmhqHcghNhSPh2pdJJ\nQiFgEF4GCKK5s1VkKSUfMXfcJl6HfI+lMwSGG0pcaOyJQB+MMjsOT0aADiyp\nLHIlyUzl9d6D15CgRR/pULd4kRWPxqjjG6IwtPYGCGlIHfKt8tATCBhWmYH+\nAWbSPBAa4vW2oyRbRANHBPtv7RVJ9WOpcgoskCsI3EWabSNBG2Q1L3HoqRe6\n2eKKs+2SxrxQjg3yYhdivhEn6NYa8okoWpXVE43T7UncB/peoe9iRIBTKxlQ\nnHnR\r\n=6ASb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZg+Fa7QB0BbRTijyAr4B8xJZGQ2tMjAr6DWSjPxYADgIgAUEKqwmlmD0vhL9cP15Msl08mlm1aywU04pUcwvwmVk="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.2_1599661592695_0.6812602897977567"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.1":{"name":"ipfs-message-port-client","version":"0.2.3-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.35+867d6bba","ipfs":"^0.50.3-rc.1+867d6bba","ipfs-message-port-protocol":"^0.2.1-rc.35+867d6bba","ipfs-message-port-server":"^0.2.3-rc.1+867d6bba","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"867d6bba8561adbe6ff67221472f0cbffe4e1801","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.1","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-8EsuYaB/1OVIwzt8cKgl/6D/MMH/UsKzhwPqszKONzDdZjpjf9yzeC6kr9HScJgHUwbJADiL/VEevsvdsw8clA==","shasum":"a1ed72322dfcdeaf5613b3ed7613007fb0b2686f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.1.tgz","fileCount":11,"unpackedSize":112771,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWeDFCRA9TVsSAnZWagAA4coP/0zeuXEgELPKRb8okSsT\n4Dt0WAlogHAvJdBGgcHITzbfPlrm0kuiRBgTec4Zm1X+Ytr8kDAZXdmlX3yT\nzt2HoQ/qemOFEcZ1Jx/1xbyljd89xM31XfRNfaXEOpJlrzwdfLmT8Nh9bH2u\n08FiXd6MVoh2O8D544xJfKuURa0/UOrheO6plC412/VQP8oBQtrPwbmbxv8W\nqETi+XIbN7Z7UG0iEXRQHvLzKfGwMgX8oj5XUTfWvj5ypoK48EN/dfBKH7fY\nq5qUNXt1elcX/iPKbg3fvddPwHA4KuiYNdJ10snmCj3PJKUTiIxcGSJQ3zIl\nyjmZSm7pxUpahKGxVfRVR3d1uCk9r6oyZ0L++JwHDK8uf7p0ft2LYOIIO5n+\nffBDg5djrIN9vHe0v5mB5cbP4DOqQZ3Pi8MeuLS2Lp7Gz2TJ6rPLqWLyXaox\nsKtLxePJed9hz3Bq/i0HUT/7R3WxWxOq3AsIGBl+k1z5GZ0g3kWTDqMg3+5u\ngCYg5N4HQTcGgnJZ7Vhow/Nq7ShhVABcDkvCtwnav41JberW0XLNni93tZ5j\npvxAw5oBpMTTIok6kHzYXuJrrM8eu0q2IJHm1cWILROfOs+tSpa/Xkf0cN5D\nR12RLAgjfvgYKm/ndvj+ImNDoBEKPkq3v3p2oCPnXGY8GQag2RNvrWIaLc2R\nN2GF\r\n=zM93\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDb+djQ5B9BpbqCTNmw8NWTaM6TVhdr08JtrhmRNZkNMQIgBAV6/bF9gqFKUEVPHiRYgSbgM/FUtRI3tZThjF3RZzE="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.1_1599725764896_0.7192413396949036"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.2":{"name":"ipfs-message-port-client","version":"0.2.3-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.36+49628a6f","ipfs":"^0.50.3-rc.2+49628a6f","ipfs-message-port-protocol":"^0.2.1-rc.36+49628a6f","ipfs-message-port-server":"^0.2.3-rc.2+49628a6f","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"49628a6fe9879ee8beb1eb97236de05fdcc74a5d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.2","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-kpIg4ERcGiwz461smpotTyFBWkighW1NreJ06HDw2OPARBJLtcc2LSilQK4SNxmRlRFdxNYo2BWq0if1Ovp/8g==","shasum":"71899c2ec74d652de82d701b5c8a87297336c1cc","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.2.tgz","fileCount":11,"unpackedSize":112771,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfW5PDCRA9TVsSAnZWagAAYZgP/R37GVk6n2pk3MrCkXKF\n+/kJJUAZF297nRpgc52CAvhLfczWASPPn8I1tqkKGvNQUZfKDNkduuEPecxJ\nsR7QIu9UhlKXcKuCgccGe9b0/5EVGcLnvyH3JsGbYV5yhfHLx/VBKr2ri98/\nBsh7heBhNdAcU457PF8UtPzMGyJw3B0+lsCEosj61Pb9C91Y1FveWAKPzVkZ\nFnJodcHqBgxlnK4UikcyPfGsJ7vcQPn9H4EryI1HaQMKWPV06Oo7LfIQ8OcB\nDzY0ndt9RXctqvglByBBWM1cZPIugFFBXjaFnWzuPz+fel494MeJKpkSMbTT\nxFRacyuWW0/dyAZA2UjsHviCXn9kwIn5+l6CI1QZRyR46VZAFfW9TjRiInmb\nrh2FC8ei0zVTh4u7NTy/3hTFY4akcIkjus0L7sFDe9Ngx7V1zW3cCC5I1a8s\nrxwkbLnGOe+Yt9Dt8LOh/w2XUcdN1Ui/E1+KJbU5TVF7az5/vI7XA8QAgfFn\n1KT01XC6evkOPQl7cVgPd38cYZVpdXVXUw4ZzRhA6O7ETsX0xl5/T+R+bOEM\no6oEzUXg1WXDsRx0SAaSPrIrM5/Bk0zDruJbLeYDVVk8fZ4/vJKWIv2U+e++\n1MIvjfS/Bkl2As71PfKs6i3qa4kg3EAffY+LM2KfkfZgZ4v+pWQtI8QfOWBS\njx7r\r\n=lgW3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDH14Ez5428h7fxbxeEmTqTaexcnIwOImhSLr56ScBZjQIgST0wZ/51UuMxmabsyhIvMz6pwg5cZV9XrVD0Qu2blgA="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.2_1599837123054_0.6030715133316646"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.3":{"name":"ipfs-message-port-client","version":"0.2.3-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.37+420cddb9","ipfs":"^0.50.3-rc.3+420cddb9","ipfs-message-port-protocol":"^0.2.1-rc.37+420cddb9","ipfs-message-port-server":"^0.2.3-rc.3+420cddb9","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"420cddb99873a27e4afbf1973c7f06c5415fb883","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.3","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-m27g9oMeUAesQtI7/XxVcT1Ek06D6Y8QLnDQ8F5rAlgGuJgWofGoET9MPbMqwOzt5gs2dUtNt5B/32WQe1I1Yg==","shasum":"2f6c518e868810544242998ffb2c8c24e412a06a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.3.tgz","fileCount":11,"unpackedSize":112771,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfX2tdCRA9TVsSAnZWagAAAu4QAJRC1UDiZnbzNIWO7PmH\nX/hLnNLgh2Wygvh+aRBnl2x8quAj2m2PMnXBvEGfVwi8d6l/kTyflaBCLDlR\n7neYJt4ZT15b1e3I/kt0XxiOh5I0UbUX4x/ygRn15l/elJMqkcB4YJtXBfI9\nmX+qiWZDbegbow2mMtDxmJpEOQ5rGx5YtHb2vagE+nbaqCgxtkh/qZmOJj1b\nXDAV+rD8B0BnpRcVM+MtBLmewzyTa7VwthmXdWxer1eX9cHxvghgPKuAhJ4Q\nwb0Q4oLrmub4zPXmLljLlMGCjDBlZ0TrhwiVm5Nl+L4/tlKehmLxdaiD9jPr\nUVt12hmA6gu2o6Mu56CFRCtJe7jL+ReIjO34n5p9nRpVVMECMY84WPu5UKXK\ndVtfdE2LCfdM7lr0cWO2OA0VvfhABNfALHQ0SuQBx3zJLEcnockVfvL6O71V\nMA4h7B0ViRgv0mZIu0Gmud0SiRPFciFjFJcDVJjSu5hAPcie7ZZfgt0QMHZ3\nj5QWGkMJ3/JSlu2UJPKzaaUDsMx7JazRZmYDXAqz5buMpzx5Z5tO63I0ee2I\nYQJX6eWSEKGZGAy5yaxTLPoAB4ienFCrlq5OS2URs25kMC26WdQsN1MwFbJJ\nFrd47kDs3WpqNGESWH4WJ3EylaxwiomMky0wrgc2ECLwAPek8rs79diMBhcz\nCdGX\r\n=ZIY3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6CU1dVhyH4jS6MlTw6emnQwZ7anwxeXOjt2oy+RVlGAIhAN8zvi68i4TJcjnVPaafv8ZnDn2ZhcneTAAINAk7klyW"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.3_1600088925211_0.4333125174002821"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.4":{"name":"ipfs-message-port-client","version":"0.2.3-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"npm run test:browser","test:browser":"npm run build:test-worker && aegir test -t browser","test:chrome":"aegir test -t browser -- --browsers ChromeHeadless","test:firefox":"aegir test -t browser -- --browsers FirefoxHeadless","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.38+e8c38f48","ipfs":"^0.50.3-rc.4+e8c38f48","ipfs-message-port-protocol":"^0.2.1-rc.38+e8c38f48","ipfs-message-port-server":"^0.2.3-rc.4+e8c38f48","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"e8c38f48611a4628b04fce4f3b1feb628eabc121","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.4","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.22.1/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-oNVroeNZgXC6DEBpbt9Mqtf+V1w4ycMT74RA1XVVFUK+9yHQ/X4smtGViEfu5j/INN3sOfAsRVJcpYm7wXiTIA==","shasum":"34a5e50352d4e94c6d237e44153c1e0f481ced2b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.4.tgz","fileCount":10,"unpackedSize":89491,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfbfU9CRA9TVsSAnZWagAAZHcP/0sv7I0WEEGz8aLf3wnB\n3q8HIi/hXaWkds3QrkHk7ORzRaBaD4JoWPrW2LO25i5IhV+JSHiigUtZW/cp\nrDtZgRC7w9J+dGBV+PJmMByef/BEZW8/wPC6YAQxhklg3Lv7b9IQ53i5zCi8\nH3GJDz4hADPkwUfMvZrlLjErWxpfcDMZo9GDckG7tF5wkrl+rJ5CBUSrrOOg\n+YPPldmfhFLnJdfmNydBdKjiToQyggOtNWDozm2FKrE116z+TV+zdy4D7D7m\nFzuMojHnZtjzBoXXXycTmR/ZIoFh/FSHlmIrAaWd0RsWfeOhAJwsGcYeQLiF\neCRdPwr+nvUXsNiaPdnUvBn9SIIqLj0HrpcOiN9iSBCzjzHVkL+WvLM5NAfc\n6gIbNFJJaN0yVR/xXRfp56Ee15YcGqLhfPPLzJXzvVgUSc4BM7IZSPrZefsv\nKhZ/8riqmf8m751wPx8GQ84QVOaFj57kB94cR468d9igHtMzlXu7shSyosY1\nmIEZb7TAVZh6V+QvhY/4gle+p0QTjwMxbWDzYMsFXF25mtDG2q22lNwHSAWI\neL8WEOzNdLY2zmtpHDE7Fm1kRHJXoyqVgg41gdu+J28LgpQxlJYZRljMJ0Jk\nFlh+/pWR+BVK2LRfveRpdUwlS/WUmUp72fycXlXCtWEPSBvlDC433VR0MJy0\nHos9\r\n=Ev5m\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE87KGC3wOQ+g9oqWwo65TvBqo7Nq03v/W4rUF30JRPDAiEAs/N2Y0uf7xJEbyPcXGmrvBOLJuH/jls+ruu3eykXqks="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.4_1601041724963_0.5470389051723532"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.6":{"name":"ipfs-message-port-client","version":"0.2.3-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.40+6fd99c19","ipfs":"^0.50.3-rc.6+6fd99c19","ipfs-message-port-protocol":"^0.2.1-rc.40+6fd99c19","ipfs-message-port-server":"^0.2.3-rc.6+6fd99c19","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6fd99c19c0595d1d6e4c3aed698c76dfd979a438","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.6","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.22.1/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-KAi6yGE+NWJsq3Be+uxIORDSg5a4hhQTpk0wiRoXR6PJQTNOuq03FKwtc+wE8ZDiVzJX2l0gtxUSc95/ESiOXA==","shasum":"9145a42362587bca32b3692a4b9887b65444e5b1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.6.tgz","fileCount":10,"unpackedSize":89444,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfe5txCRA9TVsSAnZWagAAM2kP/R6Df+AWlbxXysYkscnQ\nAgpR9TxVclPPqMDkc3irp22DeOTDNGOFpnznjvf9q6uU6iZS7Z8I92/TSrl3\nCOILbl0GDD9COjqCaAAn5t7hAy+AW0vOq+EAv2v+1QuDgp3Jse1YtN13p0+k\neS8avK723KcxsanxsY54Kmq1aWlan9rqhaXI0FsaNqsSYj1Iv2M/cmkmMLb6\nIibcMEDkgZw7OAPG0hwKbJh5JtAA9dljCqGh79vLD3IfHgMhqGgEn0ow62VM\ni0+csy81EtsytRGOBQkWVATymZ5UPECKAp82kx4rdQfK2+YC/avxQ/ICywWC\nS7lfsnDm4pBv5wUWNMif7f+A/x1irLbMpw0SAzmzqzAz90PNTUawqVJpW0oM\nky7Uwo1QgCWqGX8uBKJDktKJarATj2O/K97Oj9LN806RUx0n68RCQMcEZLvR\nWzsTUEeOiOJm4ww5wh82JwaaJ1bs1q5fTIfjyvkabpABbIopR4JEpO0uT18v\nd2Wc87zvpllsQ997rN7Hn24i5Sw64DFq4QowFDJtpCOePsOVN/XOo3L/4cNr\nYETbzTCsg32X34M8CpwmRkr+iuIYQpwC+sYv85jxjTYS+13OBhdMJ34eMjQC\nS1sa9RpysYwK+mPWOxWeKCJDZBW3VyLbm0BVFBmdOJHc2WgCS85KklN/eIWx\nY2i4\r\n=gWpe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFgrWKmua1UaLD6WZmqxgUNSTjV85TImm+BRO8hkBGHvAiBHX7eRVIwbfEG3zM6bIBV6D8N1N0iiksddqCy40HmbPQ=="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.6_1601936241277_0.2243559415593852"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.7":{"name":"ipfs-message-port-client","version":"0.2.3-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.41+0312c415","ipfs":"^0.50.3-rc.7+0312c415","ipfs-message-port-protocol":"^0.2.1-rc.41+0312c415","ipfs-message-port-server":"^0.2.3-rc.7+0312c415","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"0312c4158640b6ee9640ace9d91d7469df7210b3","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.7","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.22.1/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-fY6kjikom9uud1sVPM7t0O3K79pXUQgeEkgiuqVRy+SSlBPTnX0vHIQDvQ8zfgriszGxEzpRZojlI5L/QlAMLA==","shasum":"5606509ade7ce53175b5e9a29ff751aed54756a7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.7.tgz","fileCount":10,"unpackedSize":89444,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfe95SCRA9TVsSAnZWagAAInEP/Rskbhadu4c6K/d8/WSo\niYQ1YFtmALQVa9eRxeAjVVMLcLfSXVjswhNHPhHbyzAjkc9JWV7hlJSTCdQb\nSxGlLM+/f0aXcG1bUzOmCyvQJmsfEEmiFf2iAdw64OtWUBKk2rJga7/PEKbo\n/tVbXqxCednJ35h/Adsp+rxPONh5Ajy2rCnWkm3DWR4eU1eMFpQRYqq2AA0l\nW15yUc7DwxHIvPRoN8j/R8+P+qQshw/mHgdoKePIn1qamI9Fhp+ApEOFHilH\nVLEM0MwDFlN3ysAfe2cK000/R5c0veNMAD3DqeZIHEcIwnSvjrOrAnW4L6Wc\nfgItDj/pOwv1FXqD2XtFyrjwdBlc30Z/MvXi5r6hVOW8nlX+lBVsswT1MVmg\nMxugk7E4VCjvwvaWivFhETJIZnDJMCVU76Kr3ZvDa9kYLdHbqeIq1swJ+/ZQ\nkDrtgRRfqa5LaSmzt/2hsbDjTQHp1G7rPmlLoiCQk1xYPMhXAsHEidXfO26C\nAF0jlZsHbiCX/gYOlKOo2YW++7mxKH5aq9k/Y3yYKfM4BEcpoLXwLB6mN9Ku\npMBwAkNSaZSdApeW2T2dCdVvkvknoQA0a3jYmZESy6jsEEMw+X/DsEL1po7M\nsU5A3n2h13psIyFv15EwRH839JF5sFvFek61LSsFGNjRRkVX3qfhUZCep9K6\nuhM0\r\n=cbh1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICax0wfXT/ox26yERZ/Aw+Rm4s0uPhSmWTlsJcoyLoJpAiBuwnldFM+oPgIKRC35k0hD9TIjOe1zCjwsoti3HZBe2g=="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.7_1601953361825_0.16167283726234616"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.9":{"name":"ipfs-message-port-client","version":"0.2.3-rc.9","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^26.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.43+988fd211","ipfs":"^0.50.3-rc.9+988fd211","ipfs-message-port-protocol":"^0.2.1-rc.43+988fd211","ipfs-message-port-server":"^0.2.3-rc.9+988fd211","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"988fd21191886b9614b97cfec1bce53cc8a83aeb","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.9","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.22.1/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-ly86QQbvhDYy9RCoZpEKwK++T+sgumM3j4p2miGdmihh63x+PcFkzfP3G9zNV7ACDq6La2AXppJPQp2DacvxdA==","shasum":"5e0b6551e8b57b63fd83425488a31e3c49a87ea8","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.9.tgz","fileCount":10,"unpackedSize":89444,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJffEtBCRA9TVsSAnZWagAAEAkQAJQpbXm2NXbNfitYpJJy\nd4bgJFE4KA26bQ7stvzyOLg9u+tgGRxc6Kwi809FMPQjZ3ns8LswS0wMIvJu\nhzBb64aOiEf8bu4eaap5K42+GnsbvogNQKLLGZ++JQCFnMftqwPx1tGfBGyx\nnfmDK/JEzUrhZ2tlD3WeoWzO2rE0RKWjY5LpCa9Mfc2YWPf94O1AlPfv4RH6\nSKslCRugRd+NZobJmfP2VEpUmG06IeX99mqdMDeCHa2N3uvXyuTPOojBMw8k\nSdcMqKZoLMhMnnbdM/Y2rjhh/VnXPsPQq4EMJ73f/BdwJZ41Rfh740Lar70l\n/h7AR/T+NOkjDelmOI6Lts1+XgesQWOMb/DT1esjlGXD7k2SZmBXFd7K332s\n7NNy3fO0yTpsp838AcH4XUhEdNzEBo3Nl2YDejCNkpYY99tcLBxWBeBlDWgK\nEtN9/HVV1EbHTBSx87oP+LfhMqyRtdWUnvsVcP0qHVxQ5nBo4jbimet4aNQN\nVVo3CN8B5f5x1oVg4qqVh4iu4eDmiSqrVwd4BkxTAcPtdx8y2+gytLfwzNNw\nJXxgmAZ2CTPwuFeQk4z5/Wq0WDd7Cgews55qZ3BiwuH/YIX90RsQvM/Ug6sj\nwe2s3X3rP8heV0A2IMOkFXfhzb4BjbkgDPfT0FN6ZSH5u8omm/hrB2f6aydd\nghnZ\r\n=534P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCWf8oR0PWGOKfkieS30NRo13NPAtH4Qq9OXYmi4/CQ3AIgX9Y2xHah8ZQ8Ft+uGFyMjBz1wg8Bjn9TijGSKJ0+u2k="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.9_1601981249189_0.207884288040606"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.10":{"name":"ipfs-message-port-client","version":"0.2.3-rc.10","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^27.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.44+2d17bba7","ipfs":"^0.50.3-rc.10+2d17bba7","ipfs-message-port-protocol":"^0.2.1-rc.44+2d17bba7","ipfs-message-port-server":"^0.2.3-rc.10+2d17bba7","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"2d17bba7136c0a517d2de208ca917b9112d70619","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.10","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.22.1/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-kNPeAX/DOf+WHTAhrfjMfWopyN+jlroFZxvupRniVbgS3zhXkW6NKndA10VqqNBn2wSot76GQvqv222gZfMGhA==","shasum":"494960297d8935e0f775de9771fe784ec82db5bf","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.10.tgz","fileCount":10,"unpackedSize":89548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJffGZZCRA9TVsSAnZWagAAicEP/0Jpwt0KqscfeMkfZ7uK\n5Bdy8/4AQXX5nU2AadRY2y/Z3NjSDYCzobvYjrFDbRfBronoo2eCeYHJJuNW\n7n7kqIB6aO5nyFKTql0LfW0mYSuQA/hN3anerE/pkHsB1a34oacwUta1a1fz\nXZ97u9TzKITmle0+LDQydgWOt81h4rSGtSUdyXswqPYkV4nsx6LnpEpJGDRr\nzSpolRNfd+UB2YHRTgvqna8J1FNERakUMeRlqMmo49mEtNbFVKeQP2+pxsHl\ndnvHHuqTI12Aqo3W5JbBtUDKelSZyYKWYxz1I5O0Fi/wBGMcWujWGs5ev94a\nwMjxkGMDo56+zttyKdOwmoSsBMCjg5QV8VBpfOGJWpMKjq7k3RBQ8vI4vh+Y\nTFKyNBUEPMALmtzhlHmb4MgU+tPnogIBT9AuHhp5TfA1eO4/hWH9rIu4hMHS\nUnB0SDgObVGUZYaLD6oSgwTZWdfvkRWSKGV35RugZTQEWncO40UyexRQlGEx\nVpFKX2TiWW3jEOZZxJvPEOXBMli90X8B1nQAHStrkOnfODUQKxNbiD2AEdzU\nHzIkjrZlIvNTWVc7LOifTwDdwo41WW/ls2hb8DpOq5MIuZc1l6D+eoBkH7wZ\nN0EZYLvLiBRqPR1ATIvzBijqLlQZOPooDxcDRK/ddX0ZOXPCErT2/xHckD9T\n8quh\r\n=YIKZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChEsa7HOPd1d2OLHT7wXi0sNsHHeJbf6GQVkEJdq7ufgIgHEGuW/4VnDMyML7g42ReaC6Jh9BDYse7/5hEfixbaeI="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.10_1601988185355_0.6644977471132019"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.11":{"name":"ipfs-message-port-client","version":"0.2.3-rc.11","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^27.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.45+381d54a5","ipfs":"^0.50.3-rc.11+381d54a5","ipfs-message-port-protocol":"^0.2.1-rc.45+381d54a5","ipfs-message-port-server":"^0.2.3-rc.11+381d54a5","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"381d54a50a855b3f6c408d3ae8f1e3e5f9546598","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.11","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-l4kdh038KWGlTJyYd8SJRBK8y1iPfYF3nVXmoWmFAbBWa1EwVzW+6gSsSn189Bb5s3xcRg/hBK3B/ooci4wmOQ==","shasum":"745861838cab7d965b3aa948041fe14dd9cea822","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.11.tgz","fileCount":10,"unpackedSize":89548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfgW12CRA9TVsSAnZWagAAFMwP/jA41+4HN7I6l/ElRgXn\nSpOwvB4MO/VjJDT/SLh/Nmq7f2ryH0vYcZJCacIs9W4ypnzIUvkkhZO8foNy\n6K6DBgFmA8HB1p0eE4Lrsi8E0DTHmbESltnKB8qmkNdnkZU6RCQZAaI/NWqj\nGGzzJSeWfQIq/NGfOqlMcGiIrtLt9Yeu1Xx72uq9/R84YT3T2eWrHAWtokWt\nwp1jbnPbpynZ0mWgKpNyUQWguN4j2R5zhPP+bJ4mg1OEQ9LBaC4ZiWPIwTde\nW5C8wJpahPA9TQSLEIB1AVPjxl7y36M5uGfDEB7B6OKGsjnb9EHr4kPrqdih\nQlBbnxwJVMADTiE4lH0IayQajkyiOFV9g+XXTeaKrrDs7FAV3VK9WDCO5/n3\nD07e22BD23N/zUSRwzmoEjmffTTamyKe0xOT7AyxdqjXc0/qaq1NZpjdAyZJ\nC2jc6WWelA0B2WSPxEg4THva0z3Xe9BNWRrEnAFwumzecXhDuAMUgTF2KlU1\newGlj0ovqdpXe0ICkvCsHhVWONpxQBsAwzhmSddJVng6UoTjsVFVaXvcl1SG\nlq6LKA920p4wN5cJAzWE1LQjzDdSOVN4WCX3kTa3ORzV/nVRzzxowR9ALjpc\nTh/XQ22VxN5oH1Ut39usXmPxoLBMd4UiniQvXMJkS7KBYYKPWTYpLclg7JVa\nwsFU\r\n=Gx5Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHLUfbHhEEbKmU7G0vGfByrhTY/VvLv2Kb8wwRIeemgPAiEA1dmkqK/N+FbGavtk1gWowhXj+/42rFSz/hSnjlKMo7Y="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.11_1602317685959_0.7919556072851548"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.12":{"name":"ipfs-message-port-client","version":"0.2.3-rc.12","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^27.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.46+0613d79e","ipfs":"^0.50.3-rc.12+0613d79e","ipfs-message-port-protocol":"^0.2.1-rc.46+0613d79e","ipfs-message-port-server":"^0.2.3-rc.12+0613d79e","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"0613d79e3c4dd088d32de823e89099e81eef7333","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.12","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-TCFr0TudQFO8lGAGfx7cTV4m8L/5Z5d4PYdQbFlgylScDMvVHxYwsc8usibPOub9R2mBJQDnBrAXQI3g5IqaXg==","shasum":"f26e22f0a41fcb200e8a4daa96d365839d460d76","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.12.tgz","fileCount":10,"unpackedSize":89548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfgYkyCRA9TVsSAnZWagAA0fcP/1FKcQKySpOB7yEU6w1V\nhpAEfRtBIl6RZyx+5YV8fx8EchTeToOHDvNgoYACDxSIQoGg0EVoig6HH+sB\nK+sgj5m+FELEfnG5vnpYq1vcLciWpYg+TyaN/B5LOvtj07/h5KwnO1V0s+HV\nfuV6QlIsnPWypX0mW71OevzihJhmNFQkq5ooaq+4zSNEB40OtBqef6MCP9fD\nUJAZlkGyAQR1xOJnNL5vYJ/w266bFlpA9ba7NygT/SPse22VuOK1r8Uotwou\n/NvSYiXld0ymFo+F1mJvlrrp0TqonRim/b7fV/8nsZtLtZtqrZ0JVHRSlnJL\nms7wL04dk803atn99q9tWnPfNnX4x6n5Y0/Z83LK6bmGLWuaC+w1On3twxZw\nhHwUW2pF+ATNKVpjy1vn/oVuveb7YNxfirhZVMzbEQoJCjsVxIv0T5fzH6rg\nvX1Wl9UywXumvSc6n/71LoUCXKqbeJYNldsOWXt1rR3cQv/1/UxU7vdmYrse\nBqqCH6aWu4KtK6y6TAa90A/JaUyDbEPTTKSHWhuyfnXUybiM01XAnm6UOonh\nQXkV1o8gdB7VJxmaIXDAVki8N3pTD/RStGWu+gNZ27oWwuaCpdhjVi1Lr8Hw\nvEmPdDSkF1nObMj2zF6uUk1pUR53hlULSGc725hWzNfeJmhdqx1jYfYobvg9\nHUSH\r\n=bA2k\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDte2Slqmd6GSkUP5vZtGwrGShbOT2atMmzVqk/RvmxOgIhAKsJggunI13hs9t4xPFjzJCmxQ1m//fFl9aPj8Lqmalb"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.12_1602324785744_0.5022044130872481"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.14":{"name":"ipfs-message-port-client","version":"0.2.3-rc.14","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^27.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.48+8afb88e5","ipfs":"^0.50.3-rc.14+8afb88e5","ipfs-message-port-protocol":"^0.2.1-rc.48+8afb88e5","ipfs-message-port-server":"^0.2.3-rc.14+8afb88e5","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"8afb88e5ea3b0678af1aaa633f0eca6156b2130d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.14","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-HuMJOGJOJEIQ5q3ag5Nbk7eUQWFG9Kd3KGztG7VLqmxEetFoGJ1TY/TLvP+xARx91xt0KrZLm7YwTDfJ5oGr2g==","shasum":"66f5acef377862377181a68d5eece5ff34c5cbba","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.14.tgz","fileCount":10,"unpackedSize":89548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfiG6ZCRA9TVsSAnZWagAAzFoP/jtGxSyc16mK3N3c8FC7\n8FPdCuF51gVliTIfgcU+cSg0663WrNEr1ht9mX9TduO38mQJE9th+v6HxsxR\nQhiDfzZSX6cGW5361phGbK46ukYjAH+PGWZNTEMRd78WirCHqdyWRu2KKprl\negSV75EEzziG8ORyKEJl2eeLGtoX56yn28rWftUbCPY9oGcwZDkoSFQ+xXCb\nq99sxNe6OEzm2Eo3f+Hnt1pM4z3UweTVhWfFBaW3eZUpP0WHTYAWR1offbAt\nGDHmCeBJoixwTJcc3FzSeJHx+hmV0C2wZKi8VcEr/G8CzzyHYsJGNPrwlEYc\nleGQaNLpWdPrml9s8IDSJ8zte/waKgONUoY14XgGoIpH3r+ekUXVbUyxQYf0\nl+4bKlJH1FpXhxmarndnZxHyvfrmywWHSJ19PVTG8NgjcDnE2QkZyi6JzHJb\n9o3A1MtcAye4IgEj2g9n1YGldkLx2q+usVNXgwR+82sY2gGeMAzZQR5fMReC\nfyoJKnBGxTukTwRITHdXODw/Y8Uafj4TbK3GhiIx05cXATMtIPHaUDfzub9w\nU8CzQxXDvvts6a7nT+9FWb3lF2PQU83gw4+QqmaiKRrGy5ww0PURJDVGCQzO\nLKmFEU8Qhy4B/3QXGcrNxPmrLRwTRNYmX71g3Nw4fwJYJyUiswRMPNwOdS5i\niiBm\r\n=Y6kv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwYQWc6pWhQ3Ql2pHAsGTXXTvluJduDKrz5bEJ85X+OAIhALX+MwpzLJu61WYWEyJkuTP/wyUODEqNnfMTAHapJCe7"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.14_1602776729016_0.6994955068865822"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.15":{"name":"ipfs-message-port-client","version":"0.2.3-rc.15","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^27.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.49+b579b3f7","ipfs":"^0.50.3-rc.15+b579b3f7","ipfs-message-port-protocol":"^0.2.1-rc.49+b579b3f7","ipfs-message-port-server":"^0.2.3-rc.15+b579b3f7","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"b579b3f742cd07f8461a74e1f8a08eedf1ee6503","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.15","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-SLuvxDS9y2wAKbko9s9UKZS8WABG68AXFsskmHLolI+iM3mA7vx4OwBzxr21pC+nZ4PXBqiFXLo3/0YjXiWSaw==","shasum":"51b9b69262d07906940f783c426a9fbcc954516e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.15.tgz","fileCount":10,"unpackedSize":89548,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfiHLjCRA9TVsSAnZWagAAtz8P/Rxbyj1aR8CfQyv6qLAe\n6gbKYpNMeEKJlaoUcXnvxSqyOCMt0uF1yufQ7ERm64k+Sb7xrgSBMCozfH99\nDruwYJUWzuCChozhIxBzDfuo1Eqjfo2WbfhGG2T/LBekYCoCDjzo17qSFnJ9\n0D6D8cUPCeH2uuo9gDchcCdpunlYnsyA1lZCzyiDCLYZerGznF+QjmppTnM7\nsz0UjWte6LvsNmVIE5wufTjfF8xl00WaTl1N3r3LrV6VALAfvOGwfz8iD3gA\na7QIZq13OeIlnyTwXPWaDURtXRq0MGHB1GaCinsjRhmJIGVSAkamBtWWYEnH\n5PomlFJPSsi6wUof16aVp9GrnCtd5B6c4k5xhhmLA1l8jsaVClWw/XZtPbWE\ntbNkNIJ23cGLAq/s6+nHN0+RJ3lWkgcxm+BdtlIcnyPTWL+P4IpeVoFHU6zd\nMY1hqQgwfAw2jg30lHusuMAgh8PJSlWtE/1811kF/qo+csffMqHQlo4goih4\n+MCIpBK2krn2Hr31bm2jlLU8WgkXrhRdvAxemKX4uw6zDiI8uoWdleqUInK1\noQ8HUnNcctjGBfVu2/hJWLJ71mvawe33fPN2WZ0Otp0UR10lDn+yKPMGJr4h\n6xbtuoSqj1NBexUNjTlY6Iwv+rMCb57kQtiVKtm0wXr6d8LRbOqXs0gOqTgM\nO+o1\r\n=3aZb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDn14Az3B2f5MRGKqIp2zzicx2E/DQo7U6alkdjrpO6HwIgXNAoWgmMCwYnv03REJVdWoPsmTNGWr4ux0a4DW2hMzU="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.15_1602777827238_0.053673422962788875"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.16":{"name":"ipfs-message-port-client","version":"0.2.3-rc.16","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"aegir build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^27.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.50+c53491cd","ipfs":"^0.50.3-rc.16+c53491cd","ipfs-message-port-protocol":"^0.2.1-rc.50+c53491cd","ipfs-message-port-server":"^0.2.3-rc.16+c53491cd","ipld-dag-pb":"^0.20.0"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"c53491cd5fb075025f2bb995a8298b56e0ad0865","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.16","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-zBF2qBxJDYO9cSavNAZ5LMT1PnJ1oOn26H4IJwy9w5VSBRN7ZpIAWRwqLcVKasHzgNbB79PLQT2mVu32d9lKnA==","shasum":"c87ce0e40af2f0f8e5a123f3057b37b38221bc67","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.16.tgz","fileCount":10,"unpackedSize":90776,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkGXZCRA9TVsSAnZWagAA73YQAJgQxy7RRaXWcm4ef3eC\n9mwJ+R1WOSUCffA4uuZqW8xP6tg0/cqegx/Sj007G1p3sdOL/hIBlfYYkjmE\nEVCMiwW5hChLM1O0PM26QupIH9xOGauHBuhcZXcC8bQCfZqrDUwCnW5I8CM6\nsi7pulN2K2dqY7+4jNBLtvlxYpH4hMuqOco5B7Lu9X1w315J8lkuwZHhXVJa\nextNRkJvV0NC/2LJCOmHZ/U4SD6GVeMuutCS++IaJaCXBG50mr0ndm3G9vTy\nbJSzBZMFg/dFhFQdJujR64/X3bFgsu40YY9u1rspqqJ6eFYFHOcj98rq1y4b\nOm12aR/VWjse3F3ohSUW4u/nUDSTHeNtgzuZCiNidKm7MVxFipX4pJwdr+Bh\n3fm4vcp1a0PR7+AcKfYJQD5NshyFSF9KlzBSaOm3prompt1Aqw5rGAJFtEx1\nM3u5/Tdu1fRDYE1trYxremqLsbmtBUZlARfabI3E1IJsd8I+hU9XpFYcHIJL\nDKYO2cebi+y4ZYyB33ZUVIsjaEDLlAfISnNV0itanZ95bFM/HynFYF+FPINQ\nLJlEIV0qtY1+sAvz4dSIEhaQzBOcATfet+eGRxrhnnuej38OHbjeBCCg4GSs\nl0lE6+WLE0Y+yKScuRGPF3eH93aA9dM6ZZNmYF/mhMdUrqO43Pasah5SAtnq\n58iw\r\n=5elN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD56HGLMC4tFr//F62yRGtctidWn3COXkb0xy12JUz7TQIgFnQ/na32P1zpgJKGKcWtjPZmlvDQwj35RSkbvhZPd+w="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.16_1603298777566_0.23606028199397988"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.22":{"name":"ipfs-message-port-client","version":"0.2.3-rc.22","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.56+a00bb678","ipfs":"^0.50.3-rc.22+a00bb678","ipfs-message-port-protocol":"^0.2.1-rc.56+a00bb678","ipfs-message-port-server":"^0.2.3-rc.22+a00bb678","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"a00bb678f58a07194ecd130edcc8c1c7148e60b2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.22","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-yU0B3yscjleX6YjlQUaDO3b+H8qbOjShCsHN37jZ5xJFNLr9sToTnjNesc06dfamDSNkZvWs4xIOOpzdjsda4g==","shasum":"ab6a30bba5444c65a46b8def4720d165f8fe7d7d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.22.tgz","fileCount":35,"unpackedSize":196121,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkZGKCRA9TVsSAnZWagAAaC4QAI08b1nxY5nnXErdZJha\nirgQfSDa/4gtj5y+KYWy3mR2K53zQUxy3zpOVi6X7myXezffqHF5UBu/ONmK\n6zlC/6NdlchXAz7Qn5Ojd7dNYp8Sa3JytfNZQwCNZu7to6q6BCKiZhbOGDMt\niNqVbh86WK0qoo9psUTx9E4dVBOLCPl+qMu9yngniU61AkblzYLgzZWraB+U\nVl4o3AVcolsZ/hog6gqUtScBAUVvuK7MJeTkpEI7b+Njm8DXuU1pdxvMjIyx\nBlA1Mf1HXUkRpNQpqEPUm3rJBs+JLCUlEvio9Eu24bFEsz/umXYqCDl9fPqe\nTKLhw38V+OwTb31yxrpYLScyUKmeVpOcZcx9/GGdeQArkb0xEvN316HoKD8Z\nyzFb4zPkJ59yPpDTarqQqDBEgpWDLN+KJ9c/kkgyCGzOoHEhvnUaCbW9ZQIu\niz4T94KJ0Q5jr7wfBCTcLyvn7fOcRtJdp9dHLDQIv2T5gnGG1aHwk1Z9JA9I\n9/sZkalHLxxTin80DlmIS5fOY0o4EDzaCfxOsvcX+5nHB9Lp4FHAsgBNEG7A\ndaW2sYIBnzuBvnZXkW8oYYume/ZoRHRwVSyp3/ZTvg6sCXZzwn4ow6dmkwNO\nombwWyVk6NDI30KhXhgYIFW3ATetFl5pgOHBqAGr7QFQCNrvwH06Tq5CCLIs\ncs+I\r\n=uc5L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCU/qAgGZBKS/T2FQXcIKdz28nwmyXPILXlQ7y64TtIXQIhAOdqRxA/dCiStUUUcXFhmMZqU0MuP840AzNxISPDh5AE"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.22_1603375498327_0.5529736653417425"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.24":{"name":"ipfs-message-port-client","version":"0.2.3-rc.24","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.58+13eda29e","ipfs":"^0.50.3-rc.24+13eda29e","ipfs-message-port-protocol":"^0.2.1-rc.58+13eda29e","ipfs-message-port-server":"^0.2.3-rc.24+13eda29e","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"13eda29e37af836f49727d05c1a95fd072d940a8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.24","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-C6nA5nlWzfKKKcUpyfx5RS2CCSiqbSdgSLyJRzECB3T1TZk7Q3+/AvBc7LcPPlbyhyT7P5pm7KG41U/hFED4lg==","shasum":"eebd103cb293eee46669c3632a40dabdfff5c415","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.24.tgz","fileCount":35,"unpackedSize":196121,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkr9kCRA9TVsSAnZWagAA9G4P/iZGzoQ3HDNoFo20Jmcb\nYoIY8Z3Woc3qgUdpg/L/Pu/gPTgxhlsp5dDm74gDy6Z7AxxqCFIyGoCqPFjd\n2AP1mZFNoY8OLmK5dBoEYeCXy+wFRXo3Kdk+NL47TnvndKR66hQiGxVt56IF\nfo2mmLwVTkqxh5FPvIr9Tbb8xc7jXQjT4I4gX+WMBupQyujA3vml3A0/eYzA\n2/n0ClljmW7Z7rTId9XQcSIyYt7qw+GkyMNcFNK+HQxqxlcEEC/xXT6q0ubz\nXSCX6PkwJLzYuHBNYXoyjrHdYouL8dYbpV8U46oc2lgOwfMvvhuMbBoRMOfj\n4LiqNqihp8JaP2/1giabsiLP/jg3uOM7Yetvon0c5LH1vCt7ynJuNK4ZPij+\n32/GRJFqn85BsS9rCYk/MMwL8D8ggdPeFkqagpGzuXma1qIJ2nNGbGijLU+E\nJWTPzZ/Vma7ueSrFkOT7R8I9Ru6W1Njifu18k0Zjl1WE/3MqKa6c/kAL9Tej\nPsb9Att3rYWf4rNVL1egM8LAJSySHl/Vfx3ti3zIpqUuW1ftknQLlYIWA4AQ\nEoYTuU4K389USKoj4tymwUC3IoELcVWnPio/C8SS34XQ4mOCdmdJYAsthWIh\n/78Qn/ihNo31WKwZnjzIwAMTjl/PMML4JUAcN4bTO/cBz4FK8AqLwvh+wQNi\nnPMY\r\n=Ptas\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGPlz7wH1QtQhkRr/VCgkgr7RWGXH7xpqzWn46LU52W7AiEA6zvNcSTtJfqwipf2Ih4lt/MZ+ogf+wvYvRY6X0sdmyo="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.24_1603452772433_0.7108161329665466"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.25":{"name":"ipfs-message-port-client","version":"0.2.3-rc.25","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.59+94df21ea","ipfs":"^0.50.3-rc.25+94df21ea","ipfs-message-port-protocol":"^0.2.1-rc.59+94df21ea","ipfs-message-port-server":"^0.2.3-rc.25+94df21ea","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"94df21eae28c3a87bcf57e168b1379edd4674cc9","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.25","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-mAV5dtPeF6oMUjJeLQ7LFF84ek3wzkLI01P9gEIuT0oC6nS3crGLjeA2xeS1L/cd7rf3+g68lWMaG5QMHI6n2w==","shasum":"1b2e8be87572f556f08e8101ec2388efcacd20c6","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.25.tgz","fileCount":35,"unpackedSize":196119,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfl9IFCRA9TVsSAnZWagAAek0P/3Dccn7c9khTPzKs2ESC\nhgeigqcGZwrRVGMQV0WiBqOk8PjEYJ0xr1J3J3d0/YUtwfg1Duk5wUhhf/aT\ne2CwDYuB0x1FyEQaCUbzfNEZ7tfcohd2vt+5/mRFH7qDv5gq1CVHuS6/Cpwl\nQ6dbVpesrC2mdn6ycO7R8k1JiW0bSENpRvbhMDm9mUqYOeNhrObQa249oQMC\nKqLaL1qa0BauZmK79UeQ5AsFmlZtfPQoNyZQTtBtRwsOdHKjY1MMGfoX8pkt\nGAfqNb50NEvLRm368vVD+k6E3xxO1zJ6dTln7cqZL7rOsUC2KNae6JNBqTvP\ncDuqloQvgvIkFIrp/i7253lTdENNTrWRXXtQXJOXbNWGMuOCipnNu1w/FBf2\nGJmmIM8ozjG//iHLKK7ovs3Ktdy6TnV5a3udUnSbcn6xSwEecW/mIZsywbhy\nLBp1DdT5J9EeqiTL2oUQuqzqvf2D5NsOQTL5gwolqKODED0J3lWd1m2ofYc9\nzSxSm7z099rnO8X74opTubPEhVfNbZTOVa6GQuZDbFO5ZxcMWOYZdG2XMYxS\nkQAHmxwrM31ppzQAFC1UszohIyFSj2PgGtG7zEOqvtl8gJrV/uO+FOHvbrhi\nyFICMoveGVotLelJ4Igpn9eNT/ZK9mzBBVOaox5pLalBGRyYWwoGbW2Q16R2\n7eKt\r\n=NVTv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCd4ypeQ19eLY9bvBf6Hx53x2kZ7YjPxx5e6UUKkhN7zQIgZ/SWBFd0KD59iI399qbc/XsyVwmtSvQ0RQl5Q/QiVNU="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.25_1603785221260_0.10919904724406337"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.26":{"name":"ipfs-message-port-client","version":"0.2.3-rc.26","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.60+467adc3a","ipfs":"^0.50.3-rc.26+467adc3a","ipfs-message-port-protocol":"^0.2.1-rc.60+467adc3a","ipfs-message-port-server":"^0.2.3-rc.26+467adc3a","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"467adc3a3746f1c554616fbb4b79b1d62ddfcd35","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.26","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-XajzySKSltDa5IqViWFf5OussfhFuDk+/3ChETNDm9hkYEdvUpCmpskVn+zlahyqruBWCofYVvbcs5S/EGGsCg==","shasum":"5820030db9091f5abfd3dc026b98ae92cd5d246c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.26.tgz","fileCount":35,"unpackedSize":196119,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfl+ctCRA9TVsSAnZWagAA2+gP/1iwYPTD4ZZysZaOJ3cT\nDI9As+lXkhjoM7D8KITI3FpXGpgzTsfw3mowRU9Y6zivzQs+jrPMlxPRSDI4\nGhVE3XVlDI+UsaodeZTvPN8yecGMqcKo80ShH1yB9z7zHMfG91hLuxr8DTGJ\nEgXdcglATYDYtmgyhj03eBRnYCzq7qD2FJXjkSvrcQ3o22fdtVtIU+8fQQue\nj2eAnWfw0P4k+PeP7RYkKciM+wZFa1tjBGYRCGkSQU/LMhoTYIly2xtponJ0\nq62ehV8fxvSDBJBH+EAY/luYztU6aga0tS7NGAZbeOnMyzMdqK7WWGtFDqex\nwMka3DnBfTnNOEpAal2QpFzpzplpATo/NXSWN9ExcCtMnmXSOo7N4wknNSeT\nOSXHt2CP09nuKUbOqaMrhX+eGCaG79E8Vgl3Qdt8iUmfTaK2ZCK+zm6MbuR3\nV1jqy2p3/8oMsZnLmMwwns/TNiI4bxA77qPGlzz+CxXgIeF6j4OwbYDb8Wxk\nSIh7vM6X38NNbIk+ATpzEcbkiJkI24xko2CS2DkW+USUqpLrRBtrUBBhiFfn\nJjhBSq9mSiu7VfnwrykguFHoH+93PfJz74c1VW6LXKe8VoQv+hndj4v+EVBx\n2yrrHU3y6fsIisCCcGlqsXPtDJDu/9PiO4b1HW9uZFDvVXFCBcPwDQPQYVgB\nU2EN\r\n=XcEO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtIOY3eSX2T6hWPZ/1nVBiX/pc+tJrTRabt1epo3WXkAIhAIIc+kethFKGwoEIAQmzWRBktAUFu89aaGpFCazG5aex"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.26_1603790637159_0.946326336547402"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.28":{"name":"ipfs-message-port-client","version":"0.2.3-rc.28","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.62+345765c9","ipfs":"^0.50.3-rc.28+345765c9","ipfs-message-port-protocol":"^0.2.1-rc.62+345765c9","ipfs-message-port-server":"^0.2.3-rc.28+345765c9","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"345765c9287df55deb215c772bf0d863a205b116","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.28","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-f+tYoCFkQ/Ji/cHPRpcbOb0r9TPmNWTfPBqjcqrUBVVYeqxV8bir/9DanIwdRoMSyuhxNwMAD4XO8b5/l1vWeQ==","shasum":"3a7cdb84c65c37cef10582311538f74305ca5bbf","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.28.tgz","fileCount":35,"unpackedSize":196119,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmB2uCRA9TVsSAnZWagAArNYP/2E03UR/UItFNAkDv9ms\nlKgCAxnrRRjjE1cdcnZVzQ6l3ySgQCUxRz2zuADEPKRLFWQGSR1hVK0rvCCz\nGO4c1azGP59AGfOGHa5AwsghK7k9rL7MEqI32H86JvNg/26Mumw9t6XvKVKF\nqtgzoabo6Y5NIhmlkDs2h57n1HyJBpw6iyHL95p0t8ph2ZbpeW9d1a3wl9Lt\nh1RtjEhA9ID1CgnFp2Xfnk/HaOAJWVFI3Nm5gg9uq6DGCcqKqUUXaADxBrpc\nzoQok5ubPcNAp2YVn2IUKzLvVTiUEWJn7ruXsWW3Sg/GITZ7nNOuogT8OUok\nwCklOVBUHbqmzWuypMYEmjSSPfMH8atb4x9uWh0aGOpPieCgX10X9bJS4RHm\nq6yyKLKnmYJ3///RqS92bdGzIRaVv4bGgmo77f49ZmhZwm8G8w2bPQzqMv71\n29qFo490pw+by1C7anpxXlIW56CvT09eZincGtntz6D+Jw0JZxAFhrhjqaCW\nzijY5FphudLr0q7QYFdUWvYROCwrdS2emdkStsOh7UEpWUoh+nHYxDdy/Tjr\nko9aBwMHfzjId+Vgc7qX/0H2Mo67fbUWtktwLGi6UvcDvFonvMWF9KAPRjUo\nUZW6/po4Q4kMn4eOp8MZwr0HHrRK68xjv8mIV/V4ig+wRyOe82XgBsXpn67P\n9Xcv\r\n=PbtH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAk2k4FR4iKJ3i4w8KxdR0bb7iKpZUUp1NxABL65ux6eAiEA3BWk03DOtbyGW2v4vvlFIEY9u3orTROYxO34HmHEMpY="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.28_1603804590455_0.6973562106293072"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.29":{"name":"ipfs-message-port-client","version":"0.2.3-rc.29","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.63+c3772b4c","ipfs":"^0.50.3-rc.29+c3772b4c","ipfs-message-port-protocol":"^0.2.1-rc.63+c3772b4c","ipfs-message-port-server":"^0.2.3-rc.29+c3772b4c","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"c3772b4c91855da1347eb954a5cee186fc46a562","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.29","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-0za7tvWxI7NDDJ8zEAXEhgV3IpQPeU20SFeorWVaoP7V4dhYarXtZHdgnIZ/yrgHkYliu9ZOSsSpEeLDAWDxhg==","shasum":"8ddaca5f877c9a173eff5f18540576a2ab134444","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.29.tgz","fileCount":35,"unpackedSize":196119,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmDh2CRA9TVsSAnZWagAAkA8P/1BqQ+nPbSHyD937XHsz\n4rqGte5EUPR2XkkYqey5PshaVxmX9B6y9mfY2rgwh9T/JwSs1VPRH4n+DeW4\nGq2H4PxNj5cgNrLWxtpOH85iA0vJe2wOYjVyqprm31wRMj/Me2UCkobXpM1Q\n4GrBkKwquJgW/84kYGCfteieWIc8bFg0OvRqzZTCaAs5zhpuDBAVEbP4jU8G\n60PZyd3by6tZPQuUdrsEsGmG7cGDqAZHY9cZTj+D+/8LCC2Gt5+NagM/6x9M\nLLIgTuuylzm8f9eOtCjZtC4Trem3gLbQu5MyLzoodOXQ5Oyb6Ftwm5y49wt+\nl1UjZVpd7/NkmmmL0+3/8GmRSEYL/8SvbdavDY1fba2uABJ01u6+MqrwJJ7/\na62+ROI2mTOIcXgz4d1xdKG1WxxSR/AtWwOcCT4pNVWZ827mkP4FA0KRHPq7\nYCKDGfN9OwWLdlfwU5UdTvGbxSf9SUhfEoaHKC5G/HUrtMQl9A/iOQsOGxF4\nEM9TsgGHe5dN8kDrUqtX7emRtoaDzN/nmx3XGnh84I0TV/SP+NY7vQnZeGvU\n6zTysYjOFEwl/LoMi7zbFDERVnhnJqOWbJaxSlTogssXMZGEBN48L/PDiBZ2\nts45M1ByAdp7rCvWfMKqQtTdWdict53TSkIbl0iNP/X6JWgCaSw5O76JFsMI\nxqYM\r\n=qUQF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDdCBHEXWlxmRnw0NznWqAzGmZDa4CSwTT2ZV3kG3ATfAiBEavUlsqio/vVS8nu0cjsjwF4XRuuR7fbdZ7bJ2SP88g=="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.29_1603811446373_0.5928406650491669"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.2.3-rc.31":{"name":"ipfs-message-port-client","version":"0.2.3-rc.31","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.140.1-rc.65+70196444","ipfs":"^0.50.3-rc.31+70196444","ipfs-message-port-protocol":"^0.2.1-rc.65+70196444","ipfs-message-port-server":"^0.2.3-rc.31+70196444","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"70196444f942cec93d00e8feb637dbc79d5fe37a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.2.3-rc.31","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-A5VsiFD9v7pl7mAbg1oVh9SWIEY/HLStfrrAK/eY46Ht9eMxP3Y5XEhkMbMQgjwbklg08+1kqD+fPIKosTPDlg==","shasum":"44fe3c1be3fddd183bf62c02c3fed6965225302d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.2.3-rc.31.tgz","fileCount":35,"unpackedSize":197057,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmYGXCRA9TVsSAnZWagAASWUQAIysLIJpZ+jTAL8Re4gH\nElCCydz8YpxBV8oZZ3TLmTnOxxS6iaghaXMlXgLzumm1TK6N7kSJJdN7igMv\nWsX1v7lbCBfUMnxMCw3/hnW6/zWeqxUgUq9EwzrbbHqcQVudqCKaXZnLD+3e\nO2cZeXkwX4kDNL3m1YPz5pADfbfXvEYK8I1zT/rEGa/Jh++B812XqPHu7n8G\nSqOyZeysV/gFNNBrLEN4gi68YAxUE2h+BUXhxc5WExgs6LB+ZMFHahiJQkLD\nmgrJj0D0D/pwjXQe6ow+A9HzvV39lVNrUq+//LeIRdCJDGHXe87BZp2K+7vF\n4bxY+ggjVtfUiwC5jumyGxVChjJZV4kldzmPejq917LTMLgNCJRaTYWVlGPB\nX6PX+ZswvE1S5UTQY4izmrqTTJd5XPxYGu6pBDaMIaxlt6HyosuWJJqWuea6\njne0snjdiI6oI/pQjQ/IwEv38PSyZwWi/sjufC+DoM7PWkD+Q3RCDNX714vF\nrkt9mDC3pZDKY2L73V6Ob/MP6oO+2m+g57gU4lBlt5CKD9dgTwM0YuaWuTNb\nVusN2hiAxJ07YbkUq0RSsq3Nb6ONhA9GWOnj3fGAA7hBkVGr+2zrKFaD40JH\nrLynz2DpYuHkSzDWtnra/Gm8ZibDkDQEwt1ClfXidlmJ/dcnBI1XZOLPdMiR\nP1gB\r\n=23ux\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDiPvhOXrrbIWFEGd8qjy8RC75trs0OtlJPaAlIrRPCdwIhALH7vm9vVK1wQeMKEwNnnG6mAixZK60Y89B2fEfgN0ls"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.2.3-rc.31_1603895702762_0.33895106624155913"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.0":{"name":"ipfs-message-port-client","version":"0.3.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.0","ipfs":"^0.51.0","ipfs-message-port-protocol":"^0.3.0","ipfs-message-port-server":"^0.3.0","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"3f407ae0b36d6f7d2804abef956c9f035f3d298e","_id":"ipfs-message-port-client@0.3.0","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-Lwa9oCjGqryBSrIPpyhyOBm8oPcuc8MLCC+6ndKMBNctJO6njvTeg1uFiI8brLRpEaRthjLbsSK4QjRpBUJ3rA==","shasum":"95d859ac03dd776cf456e23ef1b7be4820e115ac","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.0.tgz","fileCount":35,"unpackedSize":197500,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmZOkCRA9TVsSAnZWagAAT0wP/R3Y8QRjIcrujOxOJ2P8\nv8LOXSiknkn9Bi1ra7/yI14ZYvgcHdI0jcj5wOtlEewKO1tsbrsA1Dxqj5Q8\nW5xQqAT3IpBgD7WOmutm3g3+cbdlLsg9A4kR2CuG5VUvD9MowSs1EtvYKFjp\nib1sHzLYy4zx7J1W6pGUbsy/UeodPKf+076XHC9m1KhkV4e3+JBphsqiAjD7\nPiYnD6OTPSgIzvij2crb5rtj8yT6YdIJo7LH+g6OY9U+0NjUNnXIWNqRQklC\naPbbnSQOi2cK4r+UT5voZfXo22YWI8u17nAiNAqBFYK/l5KH2tAGVefEv89Q\n23/vrSc/ufI4rMVnhUHV6mx1PAqYZ6LSl6qBEJqWsfeZC+8yf83zn07SV7pn\nTxUfPtjRC6vbu77hEBA98eC8GbDDQOn4ebsZl+FIKpmTuF0xWS+luqfOFMxI\nHwo704E0Xzcq76yf7fjvlsva8SWAZOquflTsAHajx7BaNGpvrGEVG6JUD9OK\nzDdgOKjcuK55NFKtoZF+QxozVL97bD75yxF4IiaxIgCmdlr63PahnDpouVX2\nUb/4JHAOYM6SEZs5BJ/6s8IIlfd7WaiIYavMQ3RBzxYXnpuaQ3nog/UIYS6g\ncdJ+aXKM1YSOtKnSznf18flYxjYc3a2FpVytZ3NPQZ5KR2IWms7tGedgPkgT\nFSRu\r\n=dZYH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCByGNvVxL/R4pL/tLGzGHXshDHr++292DvHrFSSIqFiAIgWAnLoIvxNXmQw5mcjV3rBf0YArwRe8NkGpM5FCk4C1U="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.0_1603900323884_0.38860342369010836"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.2":{"name":"ipfs-message-port-client","version":"0.3.1-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.2+097d7cec","ipfs":"^0.51.1-rc.2+097d7cec","ipfs-message-port-protocol":"^0.3.1-rc.2+097d7cec","ipfs-message-port-server":"^0.3.1-rc.2+097d7cec","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"097d7ceceaed9fa7983bde829f90066676b664b4","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.2","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-CwnBaARctb8NBMF+cnG+M50rBnIDEHNIuS8t6LilGXtVhPOJl3LZIu/q4xopAxBJMR2y9KYRPUb84cY1kMhDhw==","shasum":"9171b14f66db25262a95572d83f33e0ae9565a43","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.2.tgz","fileCount":35,"unpackedSize":197570,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmaVXCRA9TVsSAnZWagAAWhMQAJuaXYuBTwvtFYoaLD1c\nHEfJjM8f/C7j+WrJsjzZSa+LRtAwwfUI8EA7ozTPeRgCDQBBCKjLM0hGRAOW\n6qI1OCTFd40ls0371fTsP9xXcO8561PMZ6YU/9rDrA1qXSgoK1PXUmJE7JDm\n4TOaFszvDQS0O1MqfwU9ryJByyx3yP7z7Q4V+NvmG2NYCOwnu8CI2MDi7Ksb\nTneWnWBp32SdFtmbDopVle8zavOa6+tWkvNproZMh8elwDRPRhMscn9RogWC\nAmyqrRd6Bb3VsOTuKFcy1011EyNFKUKfQ4pqGbdVryFr/C7b4WmFlPSycPrS\nTP9WF8jlw5IC7uHK+pJJB+UzbElhqGjAtW8sgfxtpUEjhboDRAbAf0jOIrbO\ndMY0PmLhXt2IYwumihUdaCoqlP5OQT9r8GaJvg/kWQrDr77R0o0FHwtE23Nh\nGLK+hmvAk9NzYGVNTRTfMWle77NBOwggo8WQP6Ik+ZANE6x+/ziRFX6KlBC0\n4O3/aXWhSUJs0nFXxDGK/pG+vOHyDDZ/mndU4q9vNe+zC5XO6OfLj9CKvHah\noZMP+uKk2skZIQwMvl9GKhpJ39eIBoL+6S9PTQOWZ9Bk0z/TNPwaS9c4/rV6\nqxRkhZpl2i+UJmNYHiIQc/6dnvIlZXV3neE7R9/ti421eLXN+wc8/GQYY3KM\nNwJ9\r\n=3j7J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDakECCxaU7d03bpzuAXxTYXR6bfzGZPt3jGv4okfiZHQIhALevd0hg9jD5+CnLYz7/1nqOsjJ2xIQuoXu1wFpcueWd"}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.2_1603904855191_0.395279973956008"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.4":{"name":"ipfs-message-port-client","version":"0.3.1-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.4+c4d7505c","ipfs":"^0.51.1-rc.4+c4d7505c","ipfs-message-port-protocol":"^0.3.1-rc.4+c4d7505c","ipfs-message-port-server":"^0.3.1-rc.4+c4d7505c","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"c4d7505c6c5a2fbedae72d9047f1363747b4c2b0","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.4","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-eQxi+ah2VC8lxRiwA5vREwZoWKoD9MS94mdor+WC3Vsrp36x/yF5Qq0WMeS4+Mpia6bcNHr39/dtw7ocnuO/hw==","shasum":"eb9c566e5d2cfa66fa25f8817d15890f376282bd","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.4.tgz","fileCount":35,"unpackedSize":197570,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfm/mBCRA9TVsSAnZWagAAjaoP/0K08kZ0OI8Oi9hz8Xhs\nz+8E6aiC8GzUSZDINxCJ5QSQjOaU8Kz3tHNnKE7ewPZYEHdmdrEiC298CUaN\n5bQlNd4i4vDllRwkQP4az+oxWVoVgU7sMjPMAD3M7OM+6qY9Iujo3bEErglN\nF6YNoI/cTHekz1tIYQVoXfyXUzfe9/AQeAJM/yZIlNSNH7QvrHOTC5oDiMqz\nsKOeLw/o8XjazEN3/5+jGox85pADDXpKp75NK3sYT5XPONu6PlFx/1WpbAn3\ntSN+N7x0oL4BjL1j0tgUC84nNDwcl6L/ah+jOtGTbGtukQc+tB5SyeYq9i9j\nAP4bTg4tPb1NqrTbIdsnWBLkzConq4U1M/Q4u/4DeM0AqMML3Sh7WJeFsWty\njorET3m9HQX5O+BunyI44h081fZvo5oSo+80qFvJqGg5M8S916qIJXsTbIs1\n8G2fWYa/xksWNQvoyWmHPWJ/ASy9gdW6kpeelX+uGQgHMwIJEBrdEpY6SbLw\n5uQJkuwvT/Txa2fOcnGFduyG5yRMKACh8+8u6xnr58/7/LJZyH1L79gXeqip\nFCq8kwywGjB2RJheRdsmAklpo5AFEHkfpmhbzXehKODjUxkSy5NOXcGRJVO1\nTBdUp/qf6cJNT2Mw2S6fRnoITdKS7fW0Ic1tXoyxnbI7z2OxoLtnG1bmWxte\nHaWp\r\n=z60H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtdWVMTxkwTzDug7zC8eFrowcEvvFjP0nCT39nd8vKOwIgVIY6gNgraINtgu0SldoV1KAmPDI6bA3BGuznktVLcfc="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.4_1604057473411_0.7425581848819727"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.5":{"name":"ipfs-message-port-client","version":"0.3.1-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.5+bd8708ca","ipfs":"^0.51.1-rc.5+bd8708ca","ipfs-message-port-protocol":"^0.3.1-rc.5+bd8708ca","ipfs-message-port-server":"^0.3.1-rc.5+bd8708ca","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"bd8708cad08c9723c3c86457ddc14cec84d1793e","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.5","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-ctrV7RRN7lyassfVfBy12Bh3eO8Gq5pNvxrfoIg6E40Xy4xCpRXlqYmsXB5K8/pIiGum4f92qhoxN/rXf0IxLw==","shasum":"18ca6d3fcda71d6929e88c4454fb3be401dea0c5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.5.tgz","fileCount":35,"unpackedSize":195825,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfnDLWCRA9TVsSAnZWagAAmu0QAKAwNxsDUBUV0jDRKOf5\nAJGcce+jHz2qFNQoVRrQqSoVqp5pERdiFr6uUkZdCgsoZtbkKEQYYX9A46jK\nIEZnW5OCHihD4tMvsZgFPJ1FUYKzAAvdcxab0F0hGmUzOqy5a9TkbDMd+iRH\nGDdYy5qyejA68feRiICPTjSefnKwyayYfHCxSIA9o7/XeuXLhspifHYSpkg0\neKHlDRo8uwri0VCbTR+iIoYsf49uA9Lp6mEPvXTvmkoNeYFBqZTzyWrmO8nG\nZxWWvHsYig5jTAr3IQx8LWETKTmOj2gRYm+MjUf4bmkF+pWJYoBsZmkJBsMO\nFZZljk7s6JSYOxFgef9VAbhhIw6ey3DlALRgnDmvy9mUS0agPHMlj7DmOEfr\nFyYTEmM0jeNp50YVfldVym/hfSmgolGDIcCZ2byo1X4WHBrdlT8nQ2mZNMIF\neq3hkBPTSU00H4Odb5HHCl3OrH6AgGeeX6MthLP3nRxaDdT2dflsLNa1HZ+8\nl8Djmkq+kNPwdUVRR1ZFd7hLUPcXPEa8McH8rQ1uDO6HzhDC+vAF76qGtO58\n/rw7Si5vwzY7q3SMrB64mwZeP4dkv6DH2RZvmn+AvPVnibU1rZDIMVNrFBsR\nOOdJPxqDKNXwPbb6CciQxBuZyUW9UwYlm1/8ITNfM161LZQPSKO1wrHwEtOz\nGqPz\r\n=qZWb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgKIpKLnN/BWFTCLvkBCr55FfcLbgu5tMbEF4M0FsagQIgFsh9H+W/A9gNjnW1ZNzOt82vbGFg9d4UiPaBccszI0g="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.5_1604072150254_0.9569996675858632"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.6":{"name":"ipfs-message-port-client","version":"0.3.1-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.6+059520a2","ipfs":"^0.51.1-rc.6+059520a2","ipfs-message-port-protocol":"^0.3.1-rc.6+059520a2","ipfs-message-port-server":"^0.3.1-rc.6+059520a2","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"059520a2a3467952650dc9f45d8df790251f932a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a \nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.6","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-FpNUBX5J+Ntbmdye6ZXD3nqgCBJh5Vt+e5+U9UzwXbHHBP2RtA/bl4YwzgWPK5zxQSe8KA7B8xmhgiXrI8FYaQ==","shasum":"7e492701606979b42761977e97658b74344795b1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.6.tgz","fileCount":35,"unpackedSize":195825,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfnEUaCRA9TVsSAnZWagAAf0QQAImGkXkGTMD1f+gqvoqs\n4DJfyODB+ATwdulUg4gDg4KwL91hOlmOa4yU8KtXuYWCzhbgJppCOqgFyO/c\nVo5+vO+HJc9Kj8YUH32MY+wjM+4hU2vTLxCOa9siJ6UIjoGFyr5UgDvrLitc\nphQ2N730l2NQajFjX+u628H20n5qLqgdc6VmpJmX29eZ1RbPkigk+x1/uafB\nJlF9pkKPGnKRnhzOkvVFjTdkQUvxpm4pIoFWjHTJfc7hY1vBagb1RKjDemhI\niqZh5keLFb4SDnCGnEHUIBDK/T/ighh7nl8AJA/Iz2Z3jhvpQxRgvAmDqTLG\n0XNPHIdlPy4sF/ma3wL0rVBR4t2zyLgGIXqCx14O/vHH4s5h/2WqZNXjjXXU\nRNfAl7ftuu/zx3H9WYoPx/K0EWEVCa0U9WTr3i3BPx+shAZt/nWxqioKCsjP\n/kDIFGL0m/BEgrqwcHuQVluIp3UTwrF13YukQ/xOxbjKM2vpQGs70tdf2W4i\nY7+nKRu16ahMVIJbGPbfD90N3bLZH3COKARhbbn8QAfzlpe3gBVy92/lGXZX\nAvqIePzkICwxWKzcN+0Qa2e33I+RrssJwN5yX6IY/20nsWwF7cC2HImR9yyM\nGjZP6aHb6vnsiFAR31tyww7yv5wtbyK8a+sth2Kzc1KD6sJ9Neaaq3gBQ7Yj\nWLP/\r\n=8Q9w\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGNhon4uwnAMdUXcMBcAyVF5CwR81YUprYjGklSlE7nnAiEA/DAGzk2FeD+onaM+1gFOh8ELSxJl+ArrfoPrXu1OOKI="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.6_1604076826242_0.7968941071076925"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.8":{"name":"ipfs-message-port-client","version":"0.3.1-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.8+3d2d63a7","ipfs":"^0.51.1-rc.8+3d2d63a7","ipfs-message-port-protocol":"^0.3.1-rc.8+3d2d63a7","ipfs-message-port-server":"^0.3.1-rc.8+3d2d63a7","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"3d2d63a7dbb2f5870e26620ce1addda9dacad893","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.8","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-lOuGIVV/1B1MFrBlOOWCxUm89x6bldtv4AK9Dv1T9WuMC5q8u7P8dt1MxcDPVYrppjVen6otfvp9GvdrUSqocQ==","shasum":"82713e7c920d11f56730e0d389575c22065155fd","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.8.tgz","fileCount":35,"unpackedSize":197022,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfoA8sCRA9TVsSAnZWagAABHoP/iCv+8CEKUREITvFpsmi\n5wujUf4yYguIp3nGtayxHxQVbjU2KOwA5FRAeKv6DFOhnH20Z6r07JJrkacU\ny5gsTAAgDEdvDMDBXT+lgeuLtjlarPXO0h3KRHLNMBulD4K6LNyjQK0kn6LN\n1PEPStOLD8pp6qlhoRiFd28cfnCjmX6Tb0MpZ5+yHiXCeXuBM537Hfz/L7xD\nT7UdYXKMO8pmXnQf2O7V3V5SVfLS5V1EYC5S6XLH0ZtGYEGtQ0vlfpJQFM6b\nBpXVuZbnFfpSZqushcmkByZkKMh/j1r9o+hE1Q7zbwvrfMYhnaNDF7j+9lQj\nDTRwPwcrDVrPvnF28CAXXju1J1Buw3DvAdg7MrXwS4otn9SKCd29qp+OraB9\nJ+dBKDj75Q4fpUIrULOqoOjhtgENqepUmNaYDWrns7+5RQHmQcVnQSii5NY7\nqHci7cYuzwbp4oXEU1A/doRdmMIdJ+hEsaor0no2XhV37gFQWdtRgGQJB83W\nQMSSBr1P8g1ukzziJMjrma90lGaZRFBlalO63Z7DlZ8HcE9aYXj7gBeiVT25\n9f3IYi1s8VsOlJu0cTxKaoK+mu1NtqSvXm+ESs7Bfq2r5JUNpjJXlTZvXj+B\nLSYlB5b6oQnAFu6t/TrIhumPq7wvkiQ8ZLTMrwbi4cg+zCTEf1gawphDaROV\noJ/v\r\n=gwas\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCrej1LM8EGJmiGGQyB4/ThuezK8ywOX3yqT6ZSyd3PVQIgLQbfqFDGOU9601EbgoVSYxBnXj9XKc5+Za0E4gnJamw="}]},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.8_1604325164330_0.7283687524755458"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.10":{"name":"ipfs-message-port-client","version":"0.3.1-rc.10","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"0.0.2","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.10+02dcac1c","ipfs":"^0.51.1-rc.10+02dcac1c","ipfs-core":"^0.1.1-rc.10+02dcac1c","ipfs-message-port-protocol":"^0.3.1-rc.10+02dcac1c","ipfs-message-port-server":"^0.3.1-rc.10+02dcac1c","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"02dcac1cbd713706f6d241bac4c6c9a8bf7c03b1","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.10","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-NI2tnNmKSu9a85EJW5sh4WV2Dg/Fdp30Yv3F+/0Rw8u35eY7tls23BZrET+/IE5UOuafssh9yR8rghUlR7WeVg==","shasum":"fa3832f9ef0e35d71b2405c1254d4fffc7824f7e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.10.tgz","fileCount":38,"unpackedSize":280446,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfpZVfCRA9TVsSAnZWagAATqYP/2OX2tLhcuZwutxWt0KV\nBLATfNS/B4CYC1q1sYz28lie1TosvTrFCGcAiCkmvEE2EYrtxAQ2QGMQ0TA6\nTnTTRws9MQA1MH+pNjksWho8JswQIbRFd5kzRMP6sBqRRWfwjQKKUrpDvneT\nctnkojFQ/EJ+OG6u5rMvewY+l/Ha9zX4ylx6x3l+Q1hYJoVBGjmc1BDvLsl0\nPGiopHeVyr6UeWekybUW1ecLz2XQ8rZxUB5C7p+HqMMjsUGVXIUJfToiW1eh\nTDtEsvSjWqIXG+lzrynnPDYqh1YHwASQKeGIkXxmldDv3bUW6T4PRjeEkq4/\nPSkVT3W5aZY0uRmfmosOcdgrlQP2L5S4F7z3LOM/O2cnIeRWvrvZK5XCapMn\n8INBDQgGwwOt+Szqn40LxqzWoBzfsj93I/FGIvm2HTdbQ1iumJD8zlM4/bhO\nB1o4k1NQxXBxhCiMb9Rc1J2rIsgw8wbRdFtqpdDeOmM5aN/1cmea1BFBCF6l\nghIbqX8pSy7bawk2mENtyR/kogg+K2Y5EIz6CuGYna70Ag34xAQJseHw6Az0\nYewL4C5mbARHZ6WhGQj+kMo+vKFiyRjgu6dipkkrJkEi9ZGQYgp13ZouzuZb\njCruCFD+c9MBhm6R8/YxAmIVNAYYjqZfiXyu29kcveEdHBfd0TWjH4BOZGyX\nOrnG\r\n=CpW+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD7aCw/0+K/Vm5SlezPqfDkmBMXMKCToJG3k4KHYzl4jQIhALBX9sLY1N+yy0Lq7l/t2KGtfscTF80j0iy6P0xhhrZO"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.10_1604687199229_0.480587012525697"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.12":{"name":"ipfs-message-port-client","version":"0.3.1-rc.12","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.12+022afda0","ipfs":"^0.51.1-rc.12+022afda0","ipfs-core":"^0.1.1-rc.12+022afda0","ipfs-message-port-protocol":"^0.3.1-rc.12+022afda0","ipfs-message-port-server":"^0.3.1-rc.12+022afda0","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"022afda0dd6c3825c59c70dbcff9af2a64a1683d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.12","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-xEXgPFb0keptsVRj5ykdCseUWb86hchlPQC59vDz09Hgc0cLAfJ2RmvtZnK9VnYHNx7ZrRQs89mhaRhZp9BtrA==","shasum":"69549499d65d80a25d3155c03ef52498080297b5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.12.tgz","fileCount":38,"unpackedSize":284074,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqWpkCRA9TVsSAnZWagAA3ZMP/jNtpQ20mFIYSeZ2jHR8\ncGAqRzs1AS7kALixDqekKDdQXkB/PKuXWT/+rgn//3qpZXRxhHb8uqnjfGp+\nF60Avf/CNyzwftMG0gdV568aPC9IjLGxc/t/VZWJwBzCUIXaSizt3YNC+WUj\ntuf1cQHZrYDL1jhn4KrktkVIQHXts6qaCkHRjwI8CR3UH0ZTLEkHFBNrjVVZ\nHBk10rxebUhs+3A8+XK4pB3Wk8u5R7mbR5Uc1SyA/ozjv+mM9xsz0IVo9WT+\nRTCTbuU5vC03wfnvWZLO9oCPIaZpQWKWcjyWEg6a3zVv6rwF5rikLe0fb669\nI45UugXTDVAUwUT1muIOQTDJx1KrfXgfU0smi0jGrQeufOUh2r8ghM5jq7re\n5GoCyFaN7sH74pTvHJ6ZyaGDZqQd9pipInwEXWNXTQbPsTj/FyVrW1BlUevn\nvhUCe/d3F04wbXT29BJ+0/KK7IT2B7TLIKRX0M17XSUMunOk2MX7cLLMMpKl\no1DjVLN0/PeMjIlF7jolw6/YJwd06lh+ydqiI5d/btjVEsxRMN/hYA9uXbu3\nI1rvLpBZ3T6ZLq1kOLlvCECIcLfemP0k7o/q/xBKrS8QiZoD9HlFlvKa+e0+\n9V6OY14Th5AsnzYmwOQxTjovqO/vUA3IQuGVmyUGfi4vJJSE8mWG4WXMmxSz\nh0IR\r\n=MuP3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDGl2BeotycPYUOgyNrJDy1lDBylXIXtp+wHespo8ajQAiEA+8z1T9pLBhlB3sqPSqHFxWZ8XITE1NTtoBdExPYkXcs="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.12_1604938339929_0.5665711097679682"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.3.1-rc.13":{"name":"ipfs-message-port-client","version":"0.3.1-rc.13","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.141.1-rc.13+d2505075","ipfs":"^0.51.1-rc.13+d2505075","ipfs-core":"^0.1.1-rc.13+d2505075","ipfs-message-port-protocol":"^0.3.1-rc.13+d2505075","ipfs-message-port-server":"^0.3.1-rc.13+d2505075","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"d25050758405c784269aa59537b6a49eb9106986","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.3.1-rc.13","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-nP2Y3hd+5BsLvlz2tCM/9uzUGipZ24aa9b6sdeDX3j6qEJwVSZT3h8VLEdxZ83IWWsTtsSt977UxFNHFl+4k2A==","shasum":"69c4dbf1fd0c3d12b457c9e6396b07305c00d2e4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.3.1-rc.13.tgz","fileCount":38,"unpackedSize":284074,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqXRYCRA9TVsSAnZWagAAWcIP/2mag3QZO0UOg0e7cnLt\nrjowx8rB0RFy4TMf7tfRVVYbgCjOPwWDmoHxRMEGlDbUQIR6zU08OFRUyCnA\n6WDoAAXLja8d5D8L5pAj529iG++hHmHj9O1lnqXoTOiIhwOibuEz5lUTi0uX\nVEAFnuTWq9FgOMv/3V1dFGtz1+oK0x2o5yv016SvjzCDZsRnNLNwfSCG02aL\nTPEBABZrkNk8xg6ozooh59JCmzkHg26ZcatNe2LLDxwtTVHIrQ9sHrl4TDoA\nLsDtqFf+se4lZRVMv9Uj5iRVaiNet80Ee3VaMjmyiptz7RaQ+2wtHTcLLk6f\nFkd7gmX58/Aq1QqK9CGSyoJuhgAfPR/QaZVUX3Y0eF8P0UqCs8JhHBU0jUSQ\nX5DbN9Cb0lOrejIaaOz2mn4cPcmkmScICri2WPO7ZQbh+dY8gVRrrO2vIUk0\nVuI2a4KFCCZp+HSiJyqExX1jtj3mGfbq2pS9YFG9h9Nimhc0w6JNzEUlTtxt\nno3kkeZm4vwSqe0RcXKgbU3j9gIybgKHaJtCUpcbgjOezBxDQHZv3o33o93a\nbAF+eJHuwIWMaDWM3302XKGP9r8YTo2v893vo6jmG/pZgRn2s+osbRec2pKm\nhGgz1rGgZfGWRPigV6rDTFkjugspZlvxdgWbfVFtuFqKdVuZkuuRwVt3c+o7\n3k8q\r\n=uW3e\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRO5f/K6yuQdpydsRtuq+EFYh6tHK4R9XqivJ/JrHqcQIgaDOeTibNaWefugp9iBLDWcaHH/SLfoYq4SPscyhLDX4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.3.1-rc.13_1604940888206_0.3278257321916176"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.0":{"name":"ipfs-message-port-client","version":"0.4.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.142.0","ipfs":"^0.52.0","ipfs-core":"^0.2.0","ipfs-message-port-protocol":"^0.4.0","ipfs-message-port-server":"^0.4.0","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"fee87c5ed915f45535be1d36b3547f4be5ac0932","_id":"ipfs-message-port-client@0.4.0","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-/e489E5LrV21eJP/uBA/G1MB68YIRkDswe5FEnrpkna9vaMdvdyjePXtnjcMfinpdy8K9A8s5ZoboDWMieoJ7w==","shasum":"c590be4b2a0cb52c67fa8c4874e2753577acf556","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.0.tgz","fileCount":38,"unpackedSize":284764,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqXfECRA9TVsSAnZWagAA4OAQAJiY1/1MkGeCvSX+ddr7\nYd9K3SvWH9pVv3ty6cpFSuyIx/Ykwid2lNBnNtpEr4CvmMS/pI8+WOnS9MQ7\nVB+sqGLJ1j63qi1925RdY0UXpb7drosIC6wX5KvBTQMORblzfFMCfPBe5GuW\noIGqS/SVbYiUnEQoSjbfz4+7y44mJCqUCbQ8cC0+E5j5sQUkhIQYDMfF+fXo\nU8i7qeE4YRJ0OUHc+SoSl5Yw1LDBzlwNGkhBVB/qB5WvAVXfkh8dQirvWJ0n\nqiNZ3GdUA+q7WgzUqUGh9GUpt/b0TZodlsYHRO8/iOqsVwhNv/uyeVVDxJQJ\nUvPef6eGWHDyaO9x4jwxPENLVYYANeR8SHkq0vHaKTNY4D/SuFf4l/ZEI4eY\n5musQ8EW5ttjBrjdDKCgfcnQPnv72WiJ+yHaTT3UeBhCA7as5URODl08sGc+\nkpOGpDBax7ow8oEXfE/IJTTKRwiGavBu6JQqccbHwIcQZLUAgcmu0ZZOUCIQ\njQfMzENnY62XuXIfdkHPNkR74+eSz+ageurfLVK/FDtOAREMGTtsGgwcOMV3\nqyhZoiWCEuyyQTSF9EuTMBKg3gw+sKRjEXxMJ3o4jR3faYttzCjGGvVL98yx\nSbTVZsOafMQCLVctX0q1id2oecN9+AUUwCeR/ykn9vwbbqhIVT8WCk0cFhNg\nEczF\r\n=pHE9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDxQl4w8panyulcH2+gP1GvP/LlhvisuLYKozHkDfdswIhAPd7TWfm/lI3DAeq5dFvtiFMK5ggDK4bSzDA7hYfh7SP"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.0_1604941763696_0.0545667867373234"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.1-rc.1":{"name":"ipfs-message-port-client","version":"0.4.1-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.142.1-rc.1+500b504f","ipfs":"^0.52.1-rc.1+500b504f","ipfs-core":"^0.2.1-rc.1+500b504f","ipfs-message-port-protocol":"^0.4.1-rc.1+500b504f","ipfs-message-port-server":"^0.4.1-rc.1+500b504f","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"500b504f363d72ea8c29f4ffa471b1cc30cad1cd","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.1-rc.1","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-dKFXQ8xM0UcdWnyExi3CGxivDc/xTkr2M7Lm7wyqRlxgLYIIrgpCQrxIUjfil84aVNZgmlcVNLMD47UbQOWXUw==","shasum":"0381d50d4eeb787653aaf24b70b9a3e70cfda676","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.1-rc.1.tgz","fileCount":38,"unpackedSize":284826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqlm3CRA9TVsSAnZWagAAhk0P/3ZrQKdvyXTzH3ngEaxN\nswWF7Jrw9nIqsbQaUerlZah96PdebZqUmUOtZKQgCjCTwUorrxDzYkf6MB1e\nIqydYLCKVfmGYnfsOuweCwU2vmSpotqpWpLglM/ouwnn8EqxLV9+ggHgLlrn\nkyRrhqlVcFjCef16k06XccoS2yEdCaGpUDyR4DoY8tF/v0ZWARKbg/EfXn3z\nqKo9c9bOmcE6Q8cXsC0td8qTN7A7fFQ+QqASl+6SLUl8dcDgUfzvN1NHKNHC\n/iuz8Ur6HaZ5ebr33oA1RI6IPDeJRjM4XIWu7uLCrs5LvmsHy6cdxMTl7Con\np8hKQMPxAQz5n8yTOLb8hwAhNUfGGC8gQB1IM4lWqo5o80Nik8VDjjfZgejs\ne2+6HkU0lTPoC8PcwR8eGm3ezC6puR0qlBMRPymAfCAxl3xOLbKYIjyhd8p3\nRfCp6ThGKZYRfnIJj5Zk1FUVJ0tpfSFjVaQhYh2tQqyWYO6UmL8gEULv4F6c\nJA959cq8S29t/9Hre/C6fGutXaMuwmAblpCG78Jsncp2J0N/rjJxkSMSX0EI\n7oeFWaPAweJXsCVhKKjHDbUKdaH+3Z0IFt/xVCBl13wFQQq7ybordjTy1Qpc\nopHDpvfJo9T6NYAD7zhkmZyxwN9Myp6kCZrEYK02qDQqpARr5UF9qKGYbkou\nKM7h\r\n=RY8f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDlcrOaj0bSjOAXVPI75VWUp4DdYpTR2YShm01Zu2FrAQIgArz6xrUS8Z1ZisUMH2EYlwX8ra3L6KJLIh3PFPoiSxk="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.1-rc.1_1604999606652_0.9209131891323092"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.1-rc.3":{"name":"ipfs-message-port-client","version":"0.4.1-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.142.1-rc.3+6e383dff","ipfs":"^0.52.1-rc.3+6e383dff","ipfs-core":"^0.2.1-rc.3+6e383dff","ipfs-message-port-protocol":"^0.4.1-rc.3+6e383dff","ipfs-message-port-server":"^0.4.1-rc.3+6e383dff","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6e383dff2aa34816bc9feac240d4780a3f88cabd","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.1-rc.3","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-OIifOKPOpkBo3wsTVwfjCE48XoGqtOmuBOupTJAJS/p8toxLxczRhdIH6hwppDMZO75uOQ8gLI+ds7jRbhiVjw==","shasum":"6557440ea220b7e427ae25daf85980fc814fc703","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.1-rc.3.tgz","fileCount":38,"unpackedSize":284826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrSyRCRA9TVsSAnZWagAAD/AP/jrkdJLrgB584TPJhrHb\nxbmMYtDsCYQdiZZEPtABQbI+Pz5oW8QsVYbbP5xCpzoc9LgDTIZ0zJV6TPDn\nYsnlF4gT7zx4TkfUCtrZbW4sMtn682sV7cxIRG4s0lh1ek3lumH0TvTmeJYS\nUKlMY0z5/hjwEGWHzQXJhNiNlcgeVElopfgdelVcjbxJxFSuVk/U8P1guCwR\n+PpWEqbab3S/3pH1cju04YGiQIjfO3YtXmKIg/73xnWnytL1Q/Z86gd9wPYh\n+kbIkPp06HkDTB3EzIdGev5md3tiy6bs5Kxz9nTr+23LQNhY6VVL/BEDbul+\nP9t2CFRZWWbfarHBMiHU+nBxrMNuAFDrx2kdnvGZ7ftREd2E97EEuW8+IK0u\new2FZjCRY2L1vR9lpKrP226y5SogzYzSSt/YI7Wx2eCV5hrH7KrBbgHpxFKg\nlevL8J5eHWMgjxITBtpRT43/pWzflT8MiCLELWMtTWBCbUqIN93dbSBLcFKX\nSWzfvCyok8ww1o+bXqoQirOPL0cJv9cGLFCmPT3wo1XvIIK/BrFwEov4w2wg\naPPsNCvQ0ewrjqmV3fTqVh0LMxaSFTD8tvmpVCDeIINV6SXvgARRw2jOmDRO\nXKOojF+Gbv2RivZ0w3DYdM/U9Ngu8BNvYDiN+NqrN1wrT/6/EttevO3Cbt16\nMcz8\r\n=UN/x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVwrihr4vEDZkMEix/GljufrWIcsa8iMZ0wa6bFrG9GAIgdYj5ACSomGYbM9dWGWh29eMjXQ4dxNA/qzqa+FofDfM="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.1-rc.3_1605184657413_0.7249860979704659"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.1-rc.5":{"name":"ipfs-message-port-client","version":"0.4.1-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.0.0"},"devDependencies":{"aegir":"^28.0.0","cross-env":"^7.0.0","interface-ipfs-core":"^0.142.1-rc.5+8ff134b9","ipfs":"^0.52.1-rc.5+8ff134b9","ipfs-core":"^0.2.1-rc.5+8ff134b9","ipfs-message-port-protocol":"^0.4.1-rc.5+8ff134b9","ipfs-message-port-server":"^0.4.1-rc.5+8ff134b9","ipld-dag-pb":"^0.20.0","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"8ff134b9a2844dabb27bef38ba3f241e2c72f78e","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.1-rc.5","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-yMb6J0GHjzXC/yb48OLdND9xItwBJ9+b8OlCq2rjvyRV33clp7CgnQ9UmgjCEk/386YpUY5wRuEGbNf3kel31w==","shasum":"e454b72f0407a9f8c7828de53b6fdb31cc59d459","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.1-rc.5.tgz","fileCount":38,"unpackedSize":284826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfrlA+CRA9TVsSAnZWagAAb7MQAJnrZACoF4J33t/qvjOR\nVqRg74BdYBqhsbvpYCy/fckAadYB7LX8KWstC0E729JYLVQlMkqDz69TUrr5\nnkggP0v5ZZzV1Onprcyfic1eBzDAhA9UozS7SF2t0WJjV5BThet2qWhGD4e7\n1qav0ApN4nZJLfJaXPtyRcVFE+C2IJCynsBj43jerdBVvsfX4h/jK5a4jyBS\nZQn9SapshozQLuD6ISVYJoeH6NL7fNhIqf4Iu+UQSKICUKxkHrbuNrqM0+vV\n/qt7RdngYJZapxDL0oUWRZCKok4W7GaGHBMikqb+kwaaj3YAekv56ezqQiO6\nFYZr448wI9AUnvWsYyuaMK22+Y8bRAkx3eQDMHu2xCELxLjALIMIX+qeoTXS\nUKIQDuU1Tkd793suiKqLvq6oPKyj458EnjMM/mPcKsslWpaZyOuXb9U6x+kJ\n57JCaI9JWbt1+XATmVHLxqfl9op6/xrg8lqDCiOfGZs3w1dgamPqV5VNR59T\nLnpK0YjLv9qCKJEDl68ZKcCzZUHTeBJcFpQh372XarNIolvoTVLd7hVjaJgk\n0cuiUQWTPf6n3GGzHmfFZDl301K2slcDcCtZKsezKIU0E4bR3JXceiPCwsou\nTo8LhQGY9lAnX60LsdiQDOpDtc9NgAqIH7xaKhTnHhryvLsobtCz0gfS00xO\ngZW6\r\n=gS8B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/COlnF168R/jqxQu+vfwwCI7bP+KIIGJVgg8MQbZ7uAIgRNneoJwVEB4N7naOSSLPaBZeqV0DGyMSKQzbekuYYVw="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.1-rc.5_1605259325562_0.9369956234824219"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.1-rc.7":{"name":"ipfs-message-port-client","version":"0.4.1-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.1-rc.7+d26681ab"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.1-rc.7+d26681ab","ipfs":"^0.52.1-rc.7+d26681ab","ipfs-core":"^0.2.1-rc.7+d26681ab","ipfs-message-port-server":"^0.4.1-rc.7+d26681ab","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"d26681ab35601d9449d71f2ca5760896418e3e79","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.1-rc.7","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-EJbeGFSdW6WY4PijTpwhwSkGgV6q2HWkEkbLiGubkeFktoXhFcubnBIesnq+NQlPI4drJKz0yE2wiix+afXvYw==","shasum":"2a71f1507bf43e48d9b772437b1b8c7d96b132ea","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.1-rc.7.tgz","fileCount":38,"unpackedSize":284774,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfskjUCRA9TVsSAnZWagAAlKUQAIojlc7C3NdIwkdRfHFl\ntAZtRqzGoaLVlOAI0rGTvCkZk/DjvMUGPiABJP6Im1M3AyREPVSoKmYlA39F\n2uAphyaF0Zu2JYTZ4yYQwMDwRya+hGozIJUllvtRsVCQiyPbXSE9hLkJBQKR\nRyIhdaBIyxZ7EVR+o3VZXj8ELFVkT+q/jX4LcvWieJf6EBw2TBKWubUYyVjf\nhLoZWw6FsNvZNQOV1f8V6WAPndSL5QoOkBOpuJSn02/606KF+QrAzo6nu5hK\nmiw9WFQfCldQ5yu4WkmBpZGkTcu8a6yuXpn0D3Xmx08Cu7vrktA3Rm7cxkr7\nXur2TJUeh6++jxPeBiZzsIh0NS68suEzBV1aEhqm7rKxXT8HSkpBfTDaXuD9\nWr+B9eIwRI5rRNZ2nHa9DcV1U6IVjc+qNvYx51hAbZQf+fsU4llz7FK3o0/e\nJwUNIWk3DKygvOXsr4A077y+hG6XzxVjjPB2RqO9jrnFRlmZSTQlaolEVxO5\n2GH9h+JVUgzpHNgnd49k8tlhlBXDkujijXtT80zVn3ER9iiwEMMdIjvUcqqc\naq+/ySJiR84wsfAtOxvH6phdBQjBTCQSI8SIDj5OjBAEyt6R5r1HOuYrwDg7\ni1PjRaOMx75YG0i6nVUPsX0xvFrSexGy4BZ5D8ju0zXG8U0Yl+1Fh+0NFnb2\nx1KR\r\n=nM0A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDx1YXP39oSubb2l2pwJTN5YsyhJTHZjvotYDDDVNOoeQIgLda8KjTOONbSPj1Sjg2RmzNuObpd1S7HKkTzIpsxE3g="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.1-rc.7_1605519571865_0.5890477474092315"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.1-rc.8":{"name":"ipfs-message-port-client","version":"0.4.1-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.1-rc.8+4921e9aa"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.1-rc.8+4921e9aa","ipfs":"^0.52.1-rc.8+4921e9aa","ipfs-core":"^0.2.1-rc.8+4921e9aa","ipfs-message-port-server":"^0.4.1-rc.8+4921e9aa","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"4921e9aaa627c6fd03562c26cb7dcb201d6af936","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.1-rc.8","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-h9KGLBuwnFaz1fmCmwwEE8c3gmZA4dau7q7JBoHKPUBTMlKeL/K2bTS5PrwZr2rZAu6uEgJnS0TJqdCL0bnN4g==","shasum":"e720fdea250ef5dd2c386cafc370337ba9a5206c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.1-rc.8.tgz","fileCount":38,"unpackedSize":284774,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfslaICRA9TVsSAnZWagAA4CYP/j9CI3V3vs1L7atGRm8C\nYBr3vqGjcJ7wnP3dHlo5Qk/YMKOtyCVPFcYBLZytsWWCFoQzdPwyRAnpQCkX\ntWuawJlKyfrheDj8Bg0YVS1oc3WSbn/qqFg93zN/iAE4IjF88Kf2qTkGeJ5k\nf2UQnjL6QrVNco0BHwUs00v7R8FUoXShPvob/ZTlrnnXiK5rejebzTTqK/GL\nMRktHpd0+GCAcWXf7nv2puHAxqYm9+WIzx4wwaTGo1HYnrxW1QJE71l/qRIg\nILb/fyWI1XJvnR4JDJ9MyTS68Zcdpz83+4TFClpHIQ+dmHku7Yu4nkUJQbSt\nLaIIxOdSE2kJF8O6XB4nWiyDoIFPhTd8B3QAIXswySxDal5Yh/Ps83rIMWyx\neeioD/aW8pjUZ4GGfimyMAc++USL8RqzAtfgPTTTJmWoMlptHdbp7Fg0ueo6\nIw6Y68tiQyypvQoaH+PFGYEU69Ksa1XN275naRndchJdScOa3/KiEYZfRtbv\nyaUPKvuqI/6Ej9hGK4f6Y3PMSMOjat9dwUahMuTB0uPJAVioOCmusLzTgKit\nhgmor31MdStNvNcx72AiTpryaJkrNod5SPT+0OhHUchcntpgICymqYyeHQOR\nl5Z86YOwHdQblAng7nDT8XgL5yDIpV9360xSHwZGacoks5kDdJC5ONc3T7U9\nGcyz\r\n=9+aN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCldZEACHP/QBLwbkG2begONwlJ99P2MbGL7GK7as4DvgIgVyLxLj9PTQ4sWgntxqbsm6p6xUicpPdGj+dtwYSLxOc="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.1-rc.8_1605523079618_0.3660134509383335"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.1":{"name":"ipfs-message-port-client","version":"0.4.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.1"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.1","ipfs":"^0.52.1","ipfs-core":"^0.2.1","ipfs-message-port-server":"^0.4.1","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"fade64683d1209971cd7572ba1b556a275259541","_id":"ipfs-message-port-client@0.4.1","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-CvWbGi0KYTw9UA8QKLXyz4NvwYfTrbsisddYb+oNsiE9THPiVe9MVbUCYTueQSM1Qj9mWrEI3a2r3I2bu5PjKA==","shasum":"35d1f0bad11ecbf4d227492492480e269dc75526","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.1.tgz","fileCount":38,"unpackedSize":285059,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsmJoCRA9TVsSAnZWagAASLkP/1Y/jvULzklK4N8KFuw0\n8sIRfgBfL+NkCKUYGTuypjMdrrkJjhT/Y8zjH2o43soaSzqLpInOaQTbJ16k\nC2hwj+VJMKsrkwpfpJHxF0gntHx0bbPYRmhJdLKLjr0gTdfnjlBXe+zgN03y\nlofLjU6OQoK+pzcEJRU7cpqd2J1F7RxtmSvw7xNeSEDww+xuBC1zJOrLS+pF\n7L/IfavFthMdY8CcjMdAHV+iduFtK9woOjqcEyCz9aP4LwbZIMDGoxHpg2m2\nseS26zX5BiQn1a1BTOztwaXFtsUv7VKF0QXNWd7UtTO7Ad7n9CZRqOY3UThW\nBlSk+yg+jyrh3TxHOvwkcnw013LDd5ax49zr3RjE/x3ceQ2nFxRzd/0mCgk5\ntMm02l9WO96TnULNcR710peTGkEv2uZFZfdx8bi/FUwFpeUiucxTsyZrEazS\nBmFfV3g7T8a2K/QFap2rRvns39coDXnaj+SzRFhZMERs7vEzKZwP7ml0eTMA\njaPRnJvWjdXo4SVZFCiEUU6CC3wuZbkcTKBacVkUlZVnBaFl767NQrV6IpnN\nTuzR9HxBcPMUZnuNk08lLgrSA3eaAhr52Rk30+DqFWrq8fcOkVq2YCS0+uC1\nc+46cupoQCjdO7LV28D3WsUot6EckM/uhHxvkJTRFOt/sWbJaw5F627Qnjwj\nDu1f\r\n=euW0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE90bqgnBaMIoviiFefKfukjO3K+m24TjxSWIJIBjuMFAiEA9j0+X+/d9CwUeHGz7OEhUMscYCArzoOjI32DON71y1M="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.1_1605526119646_0.7944474898795768"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.2-rc.2":{"name":"ipfs-message-port-client","version":"0.4.2-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rm -rf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.2-rc.2+c93ae14e"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.2-rc.2+c93ae14e","ipfs":"^0.52.2-rc.2+c93ae14e","ipfs-core":"^0.2.2-rc.2+c93ae14e","ipfs-message-port-server":"^0.4.2-rc.2+c93ae14e","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"c93ae14e65b8a9ab4fbdad1fc69683db55430178","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.2-rc.2","_nodeVersion":"14.15.0","_npmVersion":"lerna/3.22.1/node@v14.15.0+x64 (linux)","dist":{"integrity":"sha512-KmvlI5U847k5bw7n9/RJ2G8NB8boMZG0HviKxhOSA/B7O4bnYZCIlYJvS4nQI23bfhGtKt2fOFsa+I3fMS4jAg==","shasum":"5960a2ec96c6ee560dfaf24f8820fd5a05885c4c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.2-rc.2.tgz","fileCount":38,"unpackedSize":285121,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfsnyyCRA9TVsSAnZWagAA4UYQAIMv1r9VTzdu6HLnz+WD\nL7vBXaZtbPcsXUfBRhyOSEfp+kAXqRqe4FLSwokE3PSvY+gdbE1NxXCAynH8\nqoSlm9j5aULJb2sLF/jRb7wSQe3rwRApS0Q2neKSyDB5zIEYORXoorMvHopI\n0ygMEs7JDdy5tx+ntRo4TfudlzwUaoQ+LNL8CVmafS+8/ZFYKJGI0A/HcO42\npKGAsvFLI9s5peKDHRM0fmAYaSk254t5vi+FkICbBJxhlQYBrxexJoINiZ6i\nuHnuJrW8JFXKC8uw5u7kleDaUUgLIe9Bpb5Lpl4cs4lmx3ZupVKg4n2yNalg\nfLeTsNe58371XaS4vYLUfoZR2r7UzILoofV0KHmwquNxEb1Xvx6nim0903i4\ndnELL89lzO3Y6mUhGLyCdlPZltLS22rcUhELvSiPHJrXMzKXFy0OEnRJRZNu\nXD7oTzM82kQ1RqqMOuLkIdT7cRAtZPxmErYiDJJb8i6nn/2yQPUOUn80zrT7\n9m46k36yzAVVUXO4nHk44ygg/SNQhFl5htvXyLL2QEwHdcm62NmpUflr/44s\nOXCm6r2LooRNZmN8e1BFmTsRLlQONdqHuUWeghGrJZIByLn3CDkWjYI6eHra\nAfxdIOvk+B4YI4emoELPWAwfGK+2woGFb77NXJzDrbH7/K6Zw79jUpoa+O30\nP/Mm\r\n=6g+w\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID2aEBM3VVVpC2Pf07e/Q63MLaZfGYkMC4P+iM0rA34iAiBkEyBNsJjJkTnperyboojDfXEf9qH4fOmhKLeVQkx0gw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.2-rc.2_1605532849882_0.17347143600543324"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.2-rc.3":{"name":"ipfs-message-port-client","version":"0.4.2-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.2-rc.3+4fde9221"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.2-rc.3+4fde9221","ipfs":"^0.52.2-rc.3+4fde9221","ipfs-core":"^0.2.2-rc.3+4fde9221","ipfs-message-port-server":"^0.4.2-rc.3+4fde9221","rimraf":"^3.0.2","typescript":"^4.0.3"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"4fde92214ca8ddef37d04ccdd2efb3a344098b3b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.2-rc.3","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-iM3MkV6B6xQM2RlSVCXiJXtDkihLLIPOnmiyu9vRcKdHdaXXdVuvFXXX2Ql6fX31o0FqeZdO8+Uek4u21iAPVQ==","shasum":"b3d87d93bf66c7a7c56b6c67423ffbadc11eb80d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.2-rc.3.tgz","fileCount":38,"unpackedSize":285155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftRkcCRA9TVsSAnZWagAA7KEP/3NsaIUnkm2HyMk/c1cd\nXi/fNW3TYXyqr3J2wZrYb5/iF2hDPpYjMgUuCMPOwNofcoeC0pbN+OnObROB\nIPRXiykpCErNnUduEG0o0qTvj2729KJfPCkbEkJIXIkWVsiexXbhMT75+6Lj\nomOmalycxbQh/aPd+T9pn41pWHyzwTlAPF+Kj7XQ86UfSoLn+MeenRn7d0XN\nZHpzlU754K2gE5Z58OGg3QfC9iKA6Os9pjGWt/8D0FViEFg+d4nQnVmabn/4\nejrzT3Rlhmic2Ws1RbNinQmgCcjB2jr72mZInuYrnWkP3LoaZYKxboln0APs\nMiNmcdpSstZr7wUNwNYL4mnJguZ51mwQ3np3LWIcth9Diu4xtnsV768nCTDo\nWJQS8j7kbDu/YUR7qXXsMv3cMbzOfqC+lMMpO8RsNwspWGY0UkUA6QPAKBUd\nGRNHeeoq9LfiN70E7gekkQZDKSf83KnrAkvLFEqj1m18oY9yObBniRgNYQSZ\n1UNPVVfoFQcBAzlgUL16xJCxc0Viyt2E5qrf3i5HzeT659wP+NWWZDDP8sdT\n+Xtht9nYJR9J6bMGHBSGSwXra8o+XdJWqATrLJ3QLN5XYQ9ez4H8Mj/ABxW4\nkzikGOYqWbvfQVFCu4um1CxwZXmZMjMd7m4rjmJHZJ+157WFJeCqoLwE3pWe\n+KUm\r\n=yAmn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHzFs3nIqYMwfbjmg6n4PvtkjAUjSmE58pv075C2CaokAiBzJTssBlh7w63iYcNpD9ilL0Db8Y88T050K3eCmSujaQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.2-rc.3_1605703963752_0.5664674256756823"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.2-rc.6":{"name":"ipfs-message-port-client","version":"0.4.2-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.2-rc.6+4281b404"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.2-rc.6+4281b404","ipfs":"^0.52.2-rc.6+4281b404","ipfs-core":"^0.2.2-rc.6+4281b404","ipfs-message-port-server":"^0.4.2-rc.6+4281b404","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"4281b40413165595e691853df3cfa19a6c219bb4","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.2-rc.6","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-xJQUn99duGIXQcJuU2Dtop0gL++srnSGWeAJISJ09HOutktwaxXSqPLLOmqvFIiUq9Nv4q2xkPbDAG/8JDKeXQ==","shasum":"13d72ea91b9899200efbe1570e4d21f8eef54211","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.2-rc.6.tgz","fileCount":38,"unpackedSize":285171,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfuFNBCRA9TVsSAnZWagAAbWgP/3yHZGPgC1NDcBmILo/Q\nUcWTg8poPcy8LMmuIZME/dysnoN/sb+dr88HQQ9/95Zlsem3lEQFT8R7ULtl\nXIeX7lWg1gxMniON2ZDPTgiQvsXbm/0Bhlb1Vf3CSbhpXnhuJgeCpPDegJ9D\nBfPOtFGZyGwAqiCUm0uJDc2EdBfEYS6mmwDuv8Eh4FRACU5wyrl0wGPGc1ki\n6xPz1qAz3U/Zdpp3fMdFCnfn9yp4zOrY4VeGGfnxxtbmOHx7too1g/lf6YlU\nI0qYCVyx9d8BY7ppsvraVwgXmQIqiz4C4zJE/IQMaXb17/tW3wu8HH4gV/JF\nczZKG4iLUznqM23WAWDqbdbeJeqKqZ6WUZsv+o6PelRitvizEndT0y1YLnmL\ngQBWIGhj773Tue9TfXr0aWK2IUTx55+xk9GHJrdhp9W9a5q8XDnOGvmRH90k\nv53hBlhNzm+xxpPSS4VDhLH6MSpmtMGiyDVuUpR2UYSzFSPGL9bkdvvJkTDr\n9Yqjp85aXnP9HdQ/EQG5tFdF7Gt1+JRb1Z+yGn+JuKDglF+Jqlp0wCeyJtCd\ndKeA6TsJJReBcpHia0t5fhU5P+ornWBOEk22nDWRiBhJk9VLJddtBPv+1VWL\nsPsR1+EYkUZwvFuOvZTDEFmzPEEZnqpes8ns4vmln/+9Tri3lQYx8gzHJNnk\nt9rb\r\n=a9Iy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEcyCUBVhVHhhM8zesHIGJPe2q9QQBTuhf3ZC3weAEiiAiEA74Sf43NTwFDhtXQUVjhnSXzM4cNPw96OcycUPopLXPA="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.2-rc.6_1605915457119_0.11470243802265534"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.2-rc.8":{"name":"ipfs-message-port-client","version":"0.4.2-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.2-rc.8+406667af"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.2-rc.8+406667af","ipfs":"^0.52.2-rc.8+406667af","ipfs-core":"^0.2.2-rc.8+406667af","ipfs-message-port-server":"^0.4.2-rc.8+406667af","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"406667afee7db879ef505badfac8b0745fd17646","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.2-rc.8","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-ynFlq9qAicQuzEG8nfboVZnPaDKhvcDre6EobXPeYGeHjQTVo9eCwcIeiupHSY7/N4/WG3SDWM9UtwEVCzWFCQ==","shasum":"1ab11d66bc5c9d0990ee9b657cb702814b58d6e3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.2-rc.8.tgz","fileCount":38,"unpackedSize":286075,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvg3fCRA9TVsSAnZWagAALOIQAIq6e98ZyKlnBNMmo2kI\nnw0uu3k/G5Pt0diE1hfyS+cR7ABfvSWvvLRzd9wOmIAPV3kTFbWLAB/Fpjgc\nt4Heo3Ma1tniCw8gMfd0prYwBQvLZ9OHKk79Qnq7xW1m4H3ZypEgqBqFzWtX\nsaUNs9mMOTFHfxGkimLzRd5GGxKyNOAu67+C9y+/6m3HCwN3EZlWsjk9jnUl\n8h23sNA16NLmm0LTJBNUG9jD88tvvtwAbCNA2QGgeZTLTmtrw99e0CtdMu0Z\nUwHma2MLw9bl+ReNyM6dylTFTxXpHI1QrZKB8Hz+JbvUxaBPxE5eX8HMQyHe\nEESI+PxRq2jkDVh4h7wAB2V1FzrVt2cBDbLNZp2vy+0lQ4KsY1YBzy/hPFxx\nEUA11hAqs9hChzzkFnSWXLx3GssQwSb/munH8ZpyRxijmt8oNCJMqHgQPpD8\n7u+n0nPxcvg9DztLQ3HTtVZbCL5CzFmB67MM26MLmLlJ3y9Wsoja/iDNcK8e\nZ2O9QWNTDqAwfUE5tpoHBD9mC83uhGb4c79J8xTLhvHSWM/e2zWNjKeXYAnF\nzFSg4Ub9/07FD6fi2rxPZvRy/lW6geXxH2FxG3f4YlIkgjsdrneD+jA1z5sZ\nCnBaQpzwBunvaA2WNelL5afQoTWhihB4GqiIQcSXAKBh2yZlC+IqZdwEiTFW\n8a9A\r\n=Omdt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGerPmlNrpCg1c1R+gvF+IOmIu9x0PihoqC4TKtnW8ubAiEAzwT8gQDJJObGr95FljSl/8TL8YOIitjcxfxzVw7ae2E="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.2-rc.8_1606290911417_0.22799015634030906"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.2":{"name":"ipfs-message-port-client","version":"0.4.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.2"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.2","ipfs":"^0.52.2","ipfs-core":"^0.3.0","ipfs-message-port-server":"^0.4.2","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6e660f50d3a4611f7ef909804249d3b0172e018d","_id":"ipfs-message-port-client@0.4.2","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-0hy/RyySjrHcsZpXr06QT83etaKduJ+EB1S7AtyFwR/TuLBzCUCf8QrchViW8bvWQVjXud2SF8TB7JvWZ1kNrw==","shasum":"faec1c6ac1eda981536ee18e782d6e5ceaf8558e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.2.tgz","fileCount":38,"unpackedSize":286205,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfvhfTCRA9TVsSAnZWagAAmC0P/3u5sh6+fTUlP58PVqso\nTwnPpnwtwyk1WHqwUTJD4/LMJtNZ5lU9zALFWCfSoZGL7xBmZ6XflEtuUHX+\nX/A7UJ/BinxDDIfxHIglbG/7VtwOAEqeponPcTkmtURTCw9kls9Q2NtjQ7yA\nOTd3Q/gCjbb4bi5kgdNE2OOMeRS7JdTzd+hDOkQ0jsXGvOcTi5AT87oxqamF\nT1wzxNcJSPkTHw9zHbGUJ6CJG4SS8e4AN6sjSmIb/m0IErnA+rqtFBByI/9F\nzVvL04xTKtjU/Ih0BuTsndGaWpm+s7j3vGjxhutOsDz+qPsKlDCY72S+Ww5W\nWSFdxeB56IpvfC9ATHp4qoQivcDR2ae7HBr4AmiIyuqouT5PtIIy4HjNshwf\nEVheFCpkAQiezzYNJ4YLj7DWUjo4Y2NvZR0nDirPGlDhxt8Sl9ZkMEOIra5u\nstssfiKe/KPgxWqVIi2OCfZu9e09Q/iFfO67hOfIjzOd+qNTZCw1BMPkuIP0\na/fNgXzhPvrCBcreujgA5T5jDrnyQaOPz2fFlZSYXQXq7UMA0GqNjv1QKC5w\nREKp9yBjcRsq35LYNrhwsDSWV+YEdtf0WAdIQwmFMcbIw47Yxf2dvC8K2Zno\nBXBqc+EzOWTBvBpn1xHmONqtz2Ml6QjN9TsWVB8LhZOEwicX9Oi4W/SV3L6W\njv+e\r\n=NWCR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqYdXGHN96oFee9ff6V2qsMA4I40MVMPMnmGxCt3AOGAIhAN7XUgP6Xmrb5A5sEALzaiPemq963ZOTKOhGbOP8kQj+"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.2_1606293458732_0.8935436222937425"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.1":{"name":"ipfs-message-port-client","version":"0.4.3-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.1+bc6e3890"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.3-rc.1+bc6e3890","ipfs":"^0.52.3-rc.1+bc6e3890","ipfs-core":"^0.3.1-rc.1+bc6e3890","ipfs-message-port-server":"^0.4.3-rc.1+bc6e3890","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"bc6e389099df351b06772e10fea7923ebb028f66","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.1","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-P7m69ADaM69IS8R6b2WYQkimZ+7VVQmUr9MvaxI5olJDR9vm9WeO+Z7EQ7XSsudHo+UEC/By/5Xf/xB9FVTfzA==","shasum":"ba8c0e2f82380a1ad294f585a3109c8b60e686eb","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.1.tgz","fileCount":38,"unpackedSize":286275,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfv2Y7CRA9TVsSAnZWagAA05AP/2/dmLX4rnsjLC6oy+O4\njqfKCX7h0QxKNQVU9yQxwZgFxWeEJDMYNe+NZbzZeE+71cyABF+TFDzN5Mpe\noHlMfXKGnA6Njjvhm0CZzLN78+3NlysY3m46ZSAimDUxQfh0BSj+W7pw+NcN\nyLfwGroleqSuztg1QUwKN1Wu3b0G4qdejXc9SQTM0QsOUVq9ZbIgyrR/XtF8\nwBuMlNQLNdT8uLBc+oSb6tG1pPsPdqjzrpE8xoK5s/EfgllvIP4Erf8RV6//\nw1tfmqTrwHLuuka4ONTMfUYYzhVU2FCR9QuaMTu9BbQunp1p3nKf+YloHXcG\nRLsPsryow4a3RSxCzo7DctAialwncKCGgEKZxI5rqfntLwaVTUGUu1jo5Wej\nA4CQcSjHGz8Lb69qdm3M3PLofvNMDuK8eNmn/PwXG9coDcR7Ai2jTAyTk8Q5\n5P1ck62+2Z6RAIH+2ZgVWYNfmdZRLitC+rUQkpqBlL4eSCkRm3G1BveO0TIb\n4Bpm4arFWq1fW3RzCv1ukE1qhBwVuaUnoEDcGyiZvNEQqJvwn+Ozwu2G+OIi\n+fdQIZ1pjan9EdlMdAYPexanpd346CLUl8Ts+EpO6LV69Ug7S7onq75s/RAB\njuHyaJDlRTiKd/2j4vqrncZ6yoIJaVuyQHvNqKcX6a9XyI1ZVuhDyYRLg/iT\nAjhH\r\n=e1Xv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHLTTZdzKyNFKUniYkZOSxOnY5F19BQKP11prC0G1IRBAiAnuUjL+WG1+lW/hKkIVSaHflm6s8gPdHld1cBUnRtXFg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.1_1606379066928_0.4278066547303485"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.2":{"name":"ipfs-message-port-client","version":"0.4.3-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.2+4ed94928"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.3-rc.2+4ed94928","ipfs":"^0.52.3-rc.2+4ed94928","ipfs-core":"^0.3.1-rc.2+4ed94928","ipfs-message-port-server":"^0.4.3-rc.2+4ed94928","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"4ed949286dcbd7590c3a55880cfa9f3ff6a16f13","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.2","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-iCBfUsssTY9PHbdpbt+s6uqU+sllYqR+b5Gbdk6ULNi/8IrS/a9N/NeCamlyjNcm1jtZnIFf8hVzg6OKf6E5dQ==","shasum":"ef6a4c5fd58a294e67cfc81ab7112f1176edfef5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.2.tgz","fileCount":38,"unpackedSize":286275,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfv2iwCRA9TVsSAnZWagAAxoEQAJPMltlMer5iIuW0oBIC\nYH4fBkppXJpcZdhL09rQWRbFonGH8bCOhgmr6gYixgpKtD1wle0DNF45q8sS\n+loLXNBypU/Aw7G5HA1esxSsXpBSUW8NHdFz+Jhb0u/GXzzvicuuHIqjyXGV\nCTXo7sKvFKDf/5NRya4v6HRBK5XBQOEDSlHNhNTHwd0oi+xeYHJvghhHzDxO\n6F/9AqIiwZPixUURfeoirXZiqm8aevFkzCn3odwo47zBT1dascaRo3bjKuGB\nr1rDikkI744jvcAzXdTAzBRpOKP+L0v6HF9GC8nkAJ5Ep8UuTFIFSlm2NGTl\nzbSYemT35236sLgNrEYs6Sy5Igxp1CoAY1sGll8oBqfx/BvBmbx+2nJRtVa1\nhLcuAEFNxbe1DyfkumDuPwoE/5LC0c08a8DkN7PivSvZ0eyk83hrnBdZgJiy\n+C8yeOmxJOsjJX8M3QIJmKA0PUFAnYMTyNOqb8avHzEn+MByA37kDn9QAltQ\nDikhTnUF3wn76JpCuDW4lHJ+O18jnWjZjHNVnodcMDXjtmqvPILKcwTeE8dl\n1hnu0VKD94QpqRufiwiKqiHfMQ9XoVwIDIxOSbek3b7apu40w0izA5jttHF8\nuqabbdLVZTlMzVWk+9tqSkTQ+QiID9mElrBx/jzHrHxiIinny+i1pit+1NDF\n2wt3\r\n=HGzX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJSzm+hDh304L4oGLaDZ2FPatWIq70AUUiHdn8Q7XGVQIhANlD+QrCM0COXN75hujNaZNEJ2qAOKkgL732VxSB1ZkW"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.2_1606379696501_0.8392582544413643"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.3":{"name":"ipfs-message-port-client","version":"0.4.3-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.3+0755c253"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.3-rc.3+0755c253","ipfs":"^0.52.3-rc.3+0755c253","ipfs-core":"^0.3.1-rc.3+0755c253","ipfs-message-port-server":"^0.4.3-rc.3+0755c253","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"0755c2534cfde193e50c9b490c8717ef8ba89c63","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.3","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-TqHP8UXGVw1qVHMFAL9rvORjHHijArdMbB7JAL0+d+eVS4rUOsQ+WKzRxN+ghHWISwtP9ywS4lt1vPBc83B3XA==","shasum":"91b004b68bd14ddd44cb764d5517920b31772c57","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.3.tgz","fileCount":38,"unpackedSize":286339,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfv8qNCRA9TVsSAnZWagAAkOcQAKQTsPV0GspbJM5e3vuq\nfDRSK14qtajUgnx5l1RdhHr8lpfONk0NH2UO/NnuCvB7AH396N8KMuVlW9v1\n3q8wqNArXMqHuB58J67YgjS35DcPG0Ge4z/A9trpbTHQlPwavp03/Vyk/BrV\n30weRSjh4+MBy4ucrt/cx4Q9PQ6eXrJajANLynNjpUQrqCPGWIYt4qUak7zo\n9WZM2w4uPL/wZvUva/oYwF+6tLiGcUWFYqDCzCrKxi7RbJuWtzOuYGtgGDW7\nmE6Nic69gPOwJN1aAz1a3P/bLPVrzqIyCwKoT0MgHWLdWVtAqro5mcGTLYa5\nsrYHbEuTwaoEOnJWluYmUJVBCIpNxhaWBss8+e1Y6tFk5RMZzOKSF0HeJ1yA\nyebZyYWKJd388Z0w5uxxx7CxfG5HB1ruC1g0ylU33+be9WrM2jxQJwSKBl7x\nRx7davP1AbYx3bALBZcPL9XmbCY987XUN3JRvmcfIYVZWfnJHJW7umAU3uEb\nk5fCp/5p3F+EaKRMuaFcj6oD+EWiZ1l17qzbgxjlB8ZWw3Cm8ZOQ6EX6u/en\nSu7ebJ7pXwC35HFC4TL+LrLTuJX0/147dNU+QwUABbNn/BOzGe3Nm3SXLR5y\neGyJLA2klninOY4gPnvJShE8aeuGA3Fjg7D6wyH2TjMUE291NooYsuyLQ+ph\nEUZc\r\n=OxRV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAI65QZEVlqruHxdj2Znca8Agzzeb/cSYUpgIZ1EbyzAIhAL9R6Ys2OPUdXJKfHu3JX/LmEv+xVIApXPIYVNVkL4Wk"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.3_1606404748802_0.682490637064946"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.4":{"name":"ipfs-message-port-client","version":"0.4.3-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.4+06712481"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.3-rc.4+06712481","ipfs":"^0.52.3-rc.4+06712481","ipfs-core":"^0.3.1-rc.4+06712481","ipfs-message-port-server":"^0.4.3-rc.4+06712481","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"06712481604985f60a3d5d832b51e174e965c6bb","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitily give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] intances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.4","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-V03BchIIOeVhMubBwrnqnSVktniX9NEOcVjzT2VkHWe8s3tRKMUB/k1hf+O/LzdWB3clQOYgz7hZGMcL/dmbPQ==","shasum":"a862f0ebc418918fdff873933f433b60a5988b83","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.4.tgz","fileCount":38,"unpackedSize":286339,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfv/eGCRA9TVsSAnZWagAABPQP/1bMDLr2JWxTwbJBTE1P\nhaXYoJkZwa1UWxBZ549RdXiHOL3gmMH41rPbSzKhQRiykxDvTwsSPG8DMaCf\n2KiJKe0tkdvj2TfovYSeepdBxN2qwOIfEDh6hHN5HxsICMIOqBgl0xYC5ewM\nJlnJSAoQypgLWhnALoPr2F2j37rl6OYXbRV3ya19Zdzstr+8pt0BTFnvAWtT\nb81HLlo02L192Gbvi+rT7JpsULjjQMhzVWGfHmvIQfbFUlVTZoLUijAjPfNB\nsBjZItkmRZK9geS6flwlJZb+/gNRGtX4B9D4BQzORznRQpWjezeBTPVA/iVM\nKFnBOqWeiQitUmCiHSnZg2Jf5XpfkB5XuSjYjGFB0n1MUL/cTK4N8bEpI8xh\nsiXxuunLdxI7hCg87q0YWA5N6ZIl2acasSbu1ddrVzBmDx/A9w1Pwu4W9AP3\noE9Y2Lpmu9v1y1Sl59t5NGKNg1MFwUEYwIzgdcmA3jJ2lL+r11Yg5FAdWXI1\nF1VXqH0Onouy+u4TEvxuiMQv7NFb7tvmGn2kPYj1/qB34JPGtAcrsr54BYZC\nXU68bb3ircxLd+x1NbGm9s6ZsOfxSobeCU06ggj5iESMUIUfq9dY6EKWQ7W8\nAdQLYpB6rYs0fny48rgv1HB+B5p5EQdFbCRszKS7BjpH5mu4qOg6RwZxF6nQ\nZM+e\r\n=xoWp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEavFwQKxxoRdkvAkNUyvb2oHwlWl1IOVQCU0wcRGzp+AiAdnKt3+g1Vgq6esdnhwatY9bYYWOJfoR2PlmPVlGzM3g=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.4_1606416261616_0.922513926479998"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.7":{"name":"ipfs-message-port-client","version":"0.4.3-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.7+a4ea8fe4"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.3-rc.7+a4ea8fe4","ipfs":"^0.52.3-rc.7+a4ea8fe4","ipfs-core":"^0.3.1-rc.7+a4ea8fe4","ipfs-message-port-server":"^0.4.3-rc.7+a4ea8fe4","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"a4ea8fe4ddd0f247b7bcf42dd78a77c988667011","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.7","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-iUgEQMbYAvxEZiqkwQEv1CHGQDVYr3Av7y3+kD54opXoCP86uz8WBJaJ5dKAmvu3c9gLOb5OQEzA7gbbn9VQxQ==","shasum":"20f085eb0888128d275cb631405c8f5f965a67e1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.7.tgz","fileCount":38,"unpackedSize":286391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfyRp+CRA9TVsSAnZWagAAEK4P/j25vzw7ILi0wfvLZcJ5\nJJnAeYIKXMHIvUbG0qDEx2hrUT3p3XGT0wIaL+yWE2hDZQFCsWJhbPianG+z\naCnH4qLhDtHU2tRxIScNKbNnmmb5HCYrOyyVsqCYfTlx1NgfIPobaFvq5lHJ\nCTGZjx8T1Be0l2JdXTMqLrwcTFNaTcbmJcDLeSfEdrmSwIm1OEDuEa4+IeNL\nWjcAS3/7vR1rxn9oYOgQk4vXs2Ew21JuAQqeobvSB9lzjwwfygl+KCgN+cA2\nsP/enMk1CHkHif8SiXFuBmbPg5cjL/g3f/lC2WsAuJSD13ge539EaMQJfIma\n6+TH7+tWb7ky8kam8ad7wAoaho5GLdKlv648v4mCcA9j809Y2WZHNUYjGnTa\nC26vGM1lgeMgzxYJK4DElYPLZd8hFTPHpXty815SYrZJU7k3VfmR/gg2mdPR\nXCu8EasoTuucpwpAM/vpRK5RsDQjQ0VwbQeQ7St0Hfji71rS24CFtpkbI3lW\nik3Uc/PQn51kROcko0x9KmvN5WWbt/wx/oeCxkrB/skfIi+hcbxAw7iPxq40\nV/K41azrbLWO4ObQoeDfmdAdinMpzaFIAwFE4m+TXEEQTwQK1xm0okQr58Lx\nVYVw8wfI/vok9a/ZON7VIopAaGC/ba+BxUfaBWhR5xWt27Sozp+Ppqofh0xd\nlSXh\r\n=S3+h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqxkqfNBfVsTilMEMqXfYP0fkKMPPTe9S9sV89HYnofQIhAKcG2QbPL6tQQNbt5LHTNr7uUdaKzcRkVRNGCJpoOlP3"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.7_1607015038111_0.7535395730957621"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.8":{"name":"ipfs-message-port-client","version":"0.4.3-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.8+8ae40100"},"devDependencies":{"aegir":"^28.2.0","interface-ipfs-core":"^0.142.3-rc.8+8ae40100","ipfs":"^0.52.3-rc.8+8ae40100","ipfs-core":"^0.3.1-rc.8+8ae40100","ipfs-message-port-server":"^0.4.3-rc.8+8ae40100","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"8ae40100552ec4a389112e4dd4885904219ae4ee","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.8","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-JOXlfhiv27Yl+YKOrmN4uHLq9mgBfliLHAbwCk3WswrR0SB7Rc44tRriBThzcihSEykmx9rAadM4Iu6F1Y5sYw==","shasum":"f94267ff8d499ed37e42b8a8d3b7133fa3dfb3ce","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.8.tgz","fileCount":38,"unpackedSize":286391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfySDDCRA9TVsSAnZWagAAL40P/i/saTBKp9cmvBQawdof\ntthYDd9iYhXMhqpGMh6t3z00P/auKwcmsh4DwW3rMfX9Bn+vO/dedbv7MeHZ\npFfkACsKHSS4IlYZwk7SdRf7+D0HfJQ7+YgWxzkWC4s7y/MXz/0EKLxk4MTA\nqO6J2nYPi9IoVBDUQn0pdnQVxfj99R1drSSv9e1w7GbjbrVt9LSekJQNLn0S\nszguieY6CZ+N+fadKb/77bzB9InaJN33MmCcWzeZTCFoZmoTuUZHI0YgXVbK\nq14xgsNkZMVpGpBQDbQkM4t+F3NkkigQJM0K09hsu6UNOoSPBqf6LWW0emLb\n1dd0/d1BT8Mo3JMskWw0rEwKy2IzLUjaI3kZQiZXluSVVOUmgSOa55/9LoSk\nKt3MAVIs0ERpHE9dgQ2qsngFcqbhkJ5taUSZsaQJLypXzrHIUn6nqpjAu2DT\ncy41eLT73FDI7GVlyo1KDHeJLuNx3dQOl78ZBe2y8Kmf0PfY4mGfXDKpDv8V\nBjhPohQI0eqOH2fxLK/Pf9xbBs9k4KzvfX1MCbS8/2CurkxPb4iKMa4hN349\nILgXSnaTuCscFUHacSoFHBMitRKVbHb/iCqwxo0cqa78wYnBFKTUeMW+fzLo\nBA8kU6af7uFsmmj6XgQMOn4+QpZBD4tk71SCheA7Aa90w2yqPSQhnYyKNS9X\nSNPG\r\n=RLth\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC1OzH5c485aYGPxIy1T5zrJHjd6amgxZfkZmQ1v5x3vAiEAyQoxpbWG96z+26Aeo2RIIKAxw6jY4Sp7lQunrhOX/Q8="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.8_1607016642636_0.21783278711350107"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.11":{"name":"ipfs-message-port-client","version":"0.4.3-rc.11","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.11+f7a7a0bf"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.3-rc.11+f7a7a0bf","ipfs":"^0.52.3-rc.11+f7a7a0bf","ipfs-core":"^0.3.1-rc.11+f7a7a0bf","ipfs-message-port-server":"^0.4.3-rc.11+f7a7a0bf","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"f7a7a0bff2f87a03e554113a83c5e5aa728cba89","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.11","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-koR9shiE5KQfBbxsgxk/XT1YLlwtmR4o388HZinjIofxfXA0wcQad6UD/vw0/5gK5Vd5IKnqPpd7I5crYWhnwQ==","shasum":"6de3c11e6b045c4b0e07fbf3efa05fafb0ca57c7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.11.tgz","fileCount":38,"unpackedSize":305193,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfy0SgCRA9TVsSAnZWagAAOJAQAKSsF8KyKLUoVUdbh9AX\n50Pf5AOiWQObI/4YDwCoAMfUJj7A1N/huTSiIV9EJ9eumODCivCqsx0gi6ni\nXOFmcLU00NzBq+2zlxaXVm2TM3EufBZje3W+nnun2a4mzagI2r83fQosn6Ag\niyXJ23vnN7oxzYMqJM5XxpRfl2j8b+FHhQsS2ty3TMSO9ZkliY1wTXCFgVPQ\nC3oEPvJ3M83rho6lLyKVkX9vISxdTbfmx5dCqSvj3InqU+aUyILIbF2vqho4\nwAY8aoo6MAWF/pq+prhsoESJvj01o7ue/5Bv/xTj2E+vQ8RRNAOVosGCd5Lj\nv4D4lHKwFSGLsuI9kpkybcGUIllJfZo4CdDvBzpTzBy1PWcmsaWkMezCSODR\nS1sBhttCSTQtaDIwo2dqN4Dv2n0Fhy+nohK7tBjIeTnouuStJjkuCr5sMtke\ntlUxK5Q6dkKsDXjhJa0UGjbC8cP8lyUIc+g/TJjnOpX0NB04My7Nr/P21LhT\ncPGq8UofA7zgnU+BOQ/uGwvIgimlqnSU1Xag5keawbAnVN5aF72s1GUwECNh\ndTApOFQ95ekeFLN/LK3aGKKyN+yFWNP/6DArLgE2GeEf685JfksGVkWI8fT2\nfKc5JzggAgFnjZuOc3WFCD+5mJEU1VcFmSF0RqCAXA6c/JBZl+qUGycN/Nb2\n1fcN\r\n=v3bx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICKE5Fd2lEOkdKmH/ys+NvB10lq36nYJSg7AlBDCLGkzAiB4eC9lzFMiB6eIcdPExeIc9Ng8pGbnA5AgxDfti175BQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.11_1607156896473_0.5883402618489724"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3-rc.13":{"name":"ipfs-message-port-client","version":"0.4.3-rc.13","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3-rc.13+299a64cc"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.3-rc.13+299a64cc","ipfs":"^0.52.3-rc.13+299a64cc","ipfs-core":"^0.3.1-rc.13+299a64cc","ipfs-message-port-server":"^0.4.3-rc.13+299a64cc","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"299a64ccbe4c4c28e4e3da3f70dac363e14c78ed","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.3-rc.13","_nodeVersion":"14.15.1","_npmVersion":"lerna/3.22.1/node@v14.15.1+x64 (linux)","dist":{"integrity":"sha512-KR/VITutu5fnBT0ozP+fiaQrFODuo/R6/uRwQWU+QMP1EcJDfA0fMprYg0PC414wq9B5B/WgPs8Zg+FCYyWxig==","shasum":"ed58f5594ff38cc5732dc34ea00c294fdc6b036b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3-rc.13.tgz","fileCount":38,"unpackedSize":303947,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf13cDCRA9TVsSAnZWagAAzYAP/29sp0EcwJGwNtxly6Fl\n9OO4sLz0szbE4/k4GfspUhXiQ02NFXRkm+D2R+gN2cSiHt01SqaXnOzxMEdn\n3ugbr7xaDwLJr6ZJzj4UTuPpzyZr6pHp1aaOdt8ntZoCwX1xebqzidZ8MssH\nKVcSzbsxGd/GU8+rKtObzWpox9rYtofLZ963DvSZbeA2idvtXoF9Nugp3rPw\n1sqLrnCB2U4MK13ZSYNHnMJ+JxxqFJeU5Jo2/QDZlMrXvSJMUqJmNicvaoPR\n4AV1fk33WXb+DbOZQ3qou8kP/94hL4LMaJmB1Rq+hoM58Oa2z9/uacbgNiu4\nSeKhA5BIr7mkrFC2cVbtvvsPVE/Fwv4t4NfRYrIAp4Si/ewDdJSUebxUwtGF\neJXHKAETD8nMkX3aJrngWYhW5/GBTbgxxmZdCQGA+Ujw7FuxOPcBuotOCB4j\nQVNorjGPnnlDQIc9JIPb9Rbm4v71TFlCx6Wwi1TT/O3v0FNezDVjDqYzheXx\nDTg2bknMi4dzftPs/xAGlVh3o7dBbTUO6KOTUjiu7AvfxHa72a4R0rYkp9xu\nLMINx58lJtmH2IyNkOrzn0q/Y7GJ4A+q93lerpIxjDTeSTis9yEUdnYl4N+3\nFnM9vLYYAhmlOOu6w6YTK6E/GYY2HXqwK69BDGEEAAySliC6YhhrQl2UHxiS\nHbV6\r\n=cPFt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBkbOBzd42TWOSQxpkWQF0v+R3448qvOsOFsNS6lVzPjAiEAjIA/CPoLXCjqClTGfU9Rx4hrx+i7QUMIK9FBFpZsr1Q="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3-rc.13_1607956226822_0.028721863995645913"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.3":{"name":"ipfs-message-port-client","version":"0.4.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.3"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.3","ipfs":"^0.52.3","ipfs-core":"^0.3.1","ipfs-message-port-server":"^0.4.3","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6b207d77cd66bc5326f260221e53914192807861","_id":"ipfs-message-port-client@0.4.3","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-mdFZVaHjAQ3zSIV7opA1F6w6hAJKPjLsEKrSwKwC/pMNXB1QwX+WvlYUxdfjgTON2vB4IGZlG53shlXV1uQsWg==","shasum":"4d4f512519f38a0337b5030dbf5df4fed794792d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.3.tgz","fileCount":38,"unpackedSize":296691,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2eEICRA9TVsSAnZWagAAhV0QAIONQfupGpKWPWnL6RQe\nepUwB+AqV1y0L0w3+zgvyNRZMtqj1fbdc5VoOYfYxLiSKhyNq1YvPeE1Mx7N\ndSfHo4BeX3uNCVZPne6S6yYMGiw1pZ0xQftZ/bSX4Qrzs2G0B36Raqg9HxqG\nfo/cMTgskjNKRyOUTTpKAEHIwJ+YLg251Ix1gz4x4/023vklxZdBuVplJ+oL\nN+vF9QwP9+EsKYDf+wmcMceH045Y3Cse+UsA8hEgy9CYVOHrLTf1VsqEgEXv\n3l5UvPhYEzJQJL/tS+rFF5znZvGFmgAVswtMAXUY1RQUW+afYF4x3AtR3NuE\nlr8BIV8gMWPCAFlG1PZdThf3hwZTGvkYsFxYYuVcuU5iPsi0BkbXqSoGnEwg\nmTGx1Sg7SQGoqn/GedMYc2yKJzoKaxsbwGUlupZVKKDydSbUCFsXGEflSzmy\nNRLjJVhxqsjGMUzrKWRtRAWq/eKL5iqX2fUjZfkN/gjbUQIjr4bv5jnOOu5L\nZZrTPLd14p7i8MdJYvDBRfh0MVlEDmFTYZX1if6+5nb2vIUJjy8ew8BwBwek\nklS82iiOZ/nTsl0b4RmS+lI9xhCmbHefs3pcyYnyeD8+CPrpBc9G/x2PAEwG\nGo52XjmfANG6pZ501dPHb0EwT3CVf2ZJTQupX3eXJ/pdnthiKveWC5Hkceud\nH5qi\r\n=6dGN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGaPTTMA12IxKkvxiacyu/pdhx2q6YSGva9LKFg8lCdQIgHMTO5PkrJVEwlOSJMl90tVkmaItDEYXqYUgihF5q2VA="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.3_1608114439907_0.42962452714176624"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.4-rc.1":{"name":"ipfs-message-port-client","version":"0.4.4-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-message-port-protocol":"^0.4.4-rc.1+50147d77"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.4-rc.1+50147d77","ipfs":"^0.52.4-rc.1+50147d77","ipfs-core":"^0.3.2-rc.1+50147d77","ipfs-message-port-server":"^0.4.4-rc.1+50147d77","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"50147d77a2d69918a9371edd7329c9561626e4e1","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.4-rc.1","_nodeVersion":"14.15.3","_npmVersion":"lerna/3.22.1/node@v14.15.3+x64 (linux)","dist":{"integrity":"sha512-hD4DA7oDSfDfRzyvGk7W0OseOYAsh2arJqpXsdEmbUGHqY+MHJ+LJFRaO0WicVUGtfY2BcDwTMIUzrZZnxXDsw==","shasum":"aab5c9434f3418472b8e4c76d8899d91a5402bea","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.4-rc.1.tgz","fileCount":38,"unpackedSize":296753,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3L/7CRA9TVsSAnZWagAAEnwP/1/pnDjYRvsSKSmOjHx8\njL+94Z05Sxpal9r59ClUrBZyZXw3hxn18pkxz8uYRE/q0ao1z3LipA6QbPuj\n4AE0A6b09ThvbIWcclj/HSSge3ViZrkymrqvhs+mS/uM5d1RD3huLg2iCa55\nxHkncQ7JsR5h9T7lUu15LvyL0fy7HRhSKnaL8aC1D25sT0Z860eSvmABlKmv\nM5EvFhCQaaTHkC5UqHPuE6VlgUg+luyYzSWV7KkcSLwE6ylyMCHApJS97sNI\nSCUa/+Xd1+bLwZVFcovC8l6AryZNHIM2/vsBR2+/RdENX/2BJb6ob1LZt5Tx\nYI9ROZGoBlz4YT2bOPJuD5v07Nu9+0Y4Pl0GJVB+E/f92IGIETlg6R9YKhx+\nsCnihCtdNkQyr/llR7Nws/mxkZywkvjAEtn8ZiAdDO8ZWUscB5y+hOib9SJq\nleumkVofEZ5v1jtIYWJZiKTUOB7fX+zzhdLfx5WbliQliq2ama5+q4rmZ4En\nMcIZ3KB8ROesvro3coNh4r2+9mJSlz2X8KpmQ0poMowqNrpusvHWHKSznuXU\nP1LsB+dTZUGPxBUMyeyrsT5wp51oGHqfZzm0RR2KCS2D87qvLPYPAYDXh3NX\nn0CvZFmA4XudeBCzxxiEQ3LNvGtkLhjLesIenMnQhORWQ4uTqp85yvuHD59x\nnkVp\r\n=eXbE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDupwMThz6qzVnQmkNHFC8g/lPWs86JMD4MBrcxxy353QIgXXpz9o59lKKZApbcQMFwZM+z1stpodzKe8CqFi/EOD4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.4-rc.1_1608302587138_0.5213017111738758"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.4-rc.4":{"name":"ipfs-message-port-client","version":"0.4.4-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.1.1-rc.5957+ae497111","ipfs-message-port-protocol":"^0.4.4-rc.4+ae497111"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.4-rc.4+ae497111","ipfs":"^0.52.4-rc.4+ae497111","ipfs-core":"^0.3.2-rc.4+ae497111","ipfs-message-port-server":"^0.4.4-rc.4+ae497111","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"ae4971113534c8f988aa14314e43a00fc3df854b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.4-rc.4","_nodeVersion":"14.15.3","_npmVersion":"lerna/3.22.1/node@v14.15.3+x64 (linux)","dist":{"integrity":"sha512-HhyEztOVKwg6R1+tq5N1Ny30OPZNhKhdY+89/eegHiYATPLKenFIyIHSVKeM5a8LZ8wUzYkvlUkCPOVtP/Fxwg==","shasum":"436454f1844f3398c937daaf950e0afddfb91869","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.4-rc.4.tgz","fileCount":38,"unpackedSize":292280,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3OsNCRA9TVsSAnZWagAA2XQP/iVvzwyZYvi8fjujBa6X\ngkLBsjkuBMk5PtMOzG2GX2jGg6j05mxRsN+Q7HCfGniV0kw7pg3RWP7wz5/3\nSZDivWNS2flm7MKEE+Z86QsyGMlrrEFCBeKOCVc6WknGl6Hhbj6dpIe/OewQ\nKSAOFlanDRAdcJDBmdKxCGfQsDQrDnjQLEmFHPp/DyZ2NsWDjuuP4zyspWIU\ny9oIP+vLrAWkiPD+7G2okv1LFqPdQ7qqf/oO7u+BBKHx1NobmQo5VMkaeu8f\nueRvhi1E8u4TshpWnewvRc8CTpfiwhI3KwFTEQFQAA4ia7SY2O3vqkx/Spq9\n6T9twQ/F1cnTU1YevgNKsr1Nvck3/sjSSx0qMXZfZrtKhyLC2LdSW4MgQdpM\nd4w7CIEev5NU9tb2NOiw1Xa2zbAiLAejpuEXSayXKHjqPIzcSl3aqg6MC7bI\ncAJdWOBXWV2h8kxqCqOs1LsGDh48kUWOR5NWoAeQco4BRLHdnr/d/Ocd8kUF\neZbBdNdfPQtOyVUxHi2aiehV4tlMFNiLaMaBpHvSAcGQKlK6cbyV5omounIu\n0Wr8qDiPAeebGwJ6WhDBRUT+/sOpbjmH2Ifa1HrL1iBydFbRIv1gaRT25FpV\n1CYng2xp41b8SSqiMS755Fnj71hrT3CIiLQnpAP2rZzCiRvqjTYS4N3h5b6I\nCBzd\r\n=Uqqh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC0kqQBPrxIc9yFbe+jMw33672aVx1mCxYuEPtYJ26+zgIhAMGA1mcncg7NqgjH+XmMyJ4RF/Hw5dlRZcRSWNWqfabW"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.4-rc.4_1608313613207_0.2294950978575876"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.4-rc.5":{"name":"ipfs-message-port-client","version":"0.4.4-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.1.1-rc.5958+fad9b740","ipfs-message-port-protocol":"^0.4.4-rc.5+fad9b740"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.4-rc.5+fad9b740","ipfs":"^0.52.4-rc.5+fad9b740","ipfs-core":"^0.3.2-rc.5+fad9b740","ipfs-message-port-server":"^0.4.4-rc.5+fad9b740","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"fad9b7402e67a459e9967a1319870da165ba722a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.4-rc.5","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.22.1/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-rEiewV5hx45Q1poBcxWyhiJlV+81G4HevJzj1VQK4rcEArjwjE7Y3kiHNzUk3y4VLjQeF7QLlKNg9Ycf6q3AFQ==","shasum":"f6529f69eb91b3cc7b70dd5a6e6fd674690af3bf","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.4-rc.5.tgz","fileCount":38,"unpackedSize":292280,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf/ublCRA9TVsSAnZWagAABsgQAIkTcDUaeCPb/p0uah47\nnMiMCglgihGuaX0dgd50GmkOf/N6nvnbUjVlSiMwfXaXWPKWhavKMM/usE7T\nggmumcSnL9wsYYc8Tv4WcJ8XIbPEKJeb2DlMqQ9T4xKyFzQ1ffcGMYs8RmUe\n+nbsNCHI89qykuHIcagWodEZ4NEnVdKnN74W7Ev0/nP5FVQ1q5584ID211iC\n2Y4RZfhIcXbTYVYG4fYhiVSn8PkscDyMZhlM0G1q1r3otvuEXfg30awgbVNJ\nae31kuZe4jMJzjx9byxhcOo9ao2kSz6m+/4NItnjosTW4dv5yjFkCoy7JTcg\ntgz7xRx/HgfulnmbAOL0SYIsLBcnNQqO0Ce5YEyySb8vuBEY6VYBl4+QH3/8\ntwgnf7yLEogQQXieKTf8Sv2vr/VRhCztNhgd7y1Q//+DviRGYkpjWPuk+4xe\njenToCNlk6TVz/9M+JlDrpigmdp/oj3HH5z5gIF5/f8FK0fxSmVIMenKgdk4\nPSvlkvIdTbStoXe33PiqlSYIeisKquTYMZMRjifF3i1rpujdEuOtqbk7nGID\nwqwin6lYJFwiGaj4SaUg5wewPZLYKzey+Uuj7oJIgY/iKps7zrF3iPe+8Ipj\nxBwXmoe9sq1sHfj08kAUs8iRozxl63ncyqZBqXGdhD7hBt3fYzWdZ9AOORzw\nYnYB\r\n=+92D\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+TMXwqaihFoOHJDh46DrLTAs2OWmN9Gz7pGxMCG1EBAIhAMOtjgbPuVepPzhITSRl0iPVkO8eNFMdKkTg+r4E3GCI"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.4-rc.5_1610540773494_0.8912161882288041"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.4-rc.6":{"name":"ipfs-message-port-client","version":"0.4.4-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.1.1-rc.5959+b90a495b","ipfs-message-port-protocol":"^0.4.4-rc.6+b90a495b"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.142.4-rc.6+b90a495b","ipfs":"^0.52.4-rc.6+b90a495b","ipfs-core":"^0.3.2-rc.6+b90a495b","ipfs-message-port-server":"^0.4.4-rc.6+b90a495b","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"b90a495bd07cc81ac7a9dcad75c5625b59dc3dd9","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.4-rc.6","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.22.1/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-pHg/FTPZPoSFmUo+CKKz+rmnRzAkN109iEeAi84GUvOGW3SCoTjaJMl0Zpi+sjrudrfK9QD6gTh0WKr47FGYTQ==","shasum":"af339063830eb87045841113a643246d1c3470f7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.4-rc.6.tgz","fileCount":38,"unpackedSize":301440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgAVeFCRA9TVsSAnZWagAAcUcP/2uqtlzUG2vwtsW9/kcX\n/jTW9shLGoi2mvADSyJAv10mcpk+ozASKEJUl2Q+v+PXse9Bn3u7yQB5wk/i\nCNgGiRDbTvh5h3fZCEUmiM7E79uTSuBEuoMKzd5Ks4393Nb4C/iZfeg9hTQy\n1Hex0990jyJAtTVVsfyqxdyS9MX6FbQ0thxyh/fhpxKhyi8Nm06zBoT61ylt\nb5+kgQQbtP93N1/PkjfH9afSaA7Xn9u6F+R0xt9D2NPOhO62DvsuiCQVEF2O\nGczM1DPNP0uVMbdG3XzYA5BGeZj/2Kc/lRdgt3wT0Yj/0e3TfTIg70h2SiNK\nm1a4RBG/Cq9VJqUuXXMvkZ7SgsPn5k6LvkO9gVjBO27tLISZBaZAc36LIJa5\n+EYcTi3iBkk2lJdmrfzM3txg7GoQoVSgj77sh/nY955qqv6uBMBZcCVBnjU3\nrUQ4aaKyu8vz8ZMIo/xKirVVaOemnXO6smSh31/kFfx6Hu4vBjkyW5Q6LNWY\n1e3rtcL0BBqVFv/9a7GTZn0u5G8ItpFNeo7zp+TC2PJHmcZ165h5UGhlSQjC\n+Ry7ahRWlTT0lOflLjCaZAir3jyY++WeWcXGbJYn9e/Lhsf8JFW7uHDy6YWv\nnt8SWvCKq7eOZpkKC/hJgXnj2h5iRefzlMXlvX5aLMTffSTz8mUW0fuzgPkW\ndHo8\r\n=skQZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCODwOzfk0AkN1SJEqXGs/curtnErCKj20aputPECCGjwIhAMzzxFg28vToBaxRnLAQIxTK9q8hzf6DPXJvolPZChH7"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.4-rc.6_1610700677414_0.5944442662985423"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.4":{"name":"ipfs-message-port-client","version":"0.4.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.2.0","ipfs-message-port-protocol":"^0.5.0"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.143.0","ipfs":"^0.53.0","ipfs-core":"^0.4.0","ipfs-message-port-server":"^0.5.0","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"09f6f0cc98e2b8b2f1dacc69c9491555b507da28","_id":"ipfs-message-port-client@0.4.4","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-9jIdrT+Xm79ie30jGFYkB4ngkzIYLe+cP//wP/9VNJC4Fbv9S6AMVAb6ac03teFsmxGwn2t+hmao3HO5DxJiQg==","shasum":"5ed0154e5c5607b844009f698d6e2dd95c4e089f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.4.tgz","fileCount":38,"unpackedSize":343008,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgAX++CRA9TVsSAnZWagAALdYP/0b9ce0YnwGKYMY7pvph\nZUGQVyoxNei/7ALwYROsNB5QfSv/Eh25czoFZ6+qxKhVdvJBn/2K2LXPaQqj\nNMafAAmTN//W+xbrk/qNyytxLbk/q/viPkbUyLj2FH2OTW4T9grKwkC4xzej\nclQQJEaKAqQCNy39uQgOFAkBd8TnvuRBag1+UbsevPDF0nqqZpMhHHGQEL1i\nXGmE1ccQK9UXAVHbegl+YsFMZ6/fCq+VjkjxfkHgiiZioNva+aVe1PQYmbBv\nPIB2qPnB6ZPtZvOwoVN81KSXVunoxXilswS3Q4HQkGBh0+jsEFbKG8hMrq31\nuOlhetZcjAlcb0qyRNTUQPVfbsZvDCUAbX9I2WbSP2aPdYf8gq4dAOFwr81k\nvc7F0C33Ke5CEivpjf+xGHLFLl9wJjVcCkKCei/21ZrO6yYvbGHB1xVQhXMb\nQbV7pa9wQ2yU+ISVI2wF7FO7X+ATCXYpIet3kyWr1apEQ2lX+7CiZc/36jrb\npI1CnI8JUMaUVcvGri93odG+ukvfXbdrYRW5sSoFSfIVLWr94Eq2YMD+xxr7\nu/Kvtq7KG+fVc2PNF+3qniTQqu8BORV/fPJ2sT+cLnlRCkPACZaGONB/5KD9\ncX43A9JIdIsw+U8vyu/4yPMF90bJovM68dwptKBcdjXib6/vH9A+2I5gO41A\n4J4y\r\n=L7NA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhtrFOfIMB7Ac1NEOOrID1W5kr3lKnndPE5QeIlDJUhgIhAMrvfWUXZLavkJqYiLTkjNBoUyny5nlTIe+Ac3AE2gPo"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.4_1610710973992_0.9854090195075758"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.5":{"name":"ipfs-message-port-client","version":"0.4.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.2.0","ipfs-message-port-protocol":"^0.5.0"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.143.1","ipfs":"^0.53.1","ipfs-core":"^0.4.1","ipfs-message-port-server":"^0.5.0","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"43d5bb0318cb840814841084c038f77562ba0d98","_id":"ipfs-message-port-client@0.4.5","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-eBXJad16bkH+6grmAFvtBP8JL5hdRyJmWhUqJy7IS4e83FMJKhgwl3FZGbOpTV1fPV1OTMLfKdzH+AZgI4pygg==","shasum":"be8fe02bcee75f275aa75352fe20abf22c483b88","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.5.tgz","fileCount":38,"unpackedSize":343364,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgB+CVCRA9TVsSAnZWagAA8w4P/iWPJiYFyGg8hreLP/eM\nqjim9LxCEjFu9VaL5xKVcVD+BM8Uici7MuC8OKi/LPQGBk5GnVWVSUiURpmi\nplOslz3SnyGfT7DMUOY1vt2HznfvPTJTGz0ihQPS3kKXDQIBsGOHNF41WOYd\nLAE6zn5oQ8xaVZU3VsIwG39L+zA92nd0RbjEC+bAdNiiBcZwjBZ+HbB5vcV+\nto8AcCsJp/NSvtgzjCxOYyiN2E+RD2J96FJxwKRnDJZErL0ZzOcj+MDnvs2s\nfMKR0yoLFIYVqOjr0i90nvK2X3+vlMsdoSDhIUIZxZohLaMRdzgzUDnZO8Dc\nV6gfEg0owy7lI+N4a+/ECtJJq5CLiPzzy/VYpJVjhGul+QwNw6kGoA/ovd5P\nRySo//nPpllmPNr0INzTOXoUQRphf/lap389XKOSnmJt+bX4scLmI5pbztQo\nzbFpNRNzARDlh5mA9hxRozfcemNxFF2it71U2Om1iMKPnD4e0Pi/RCf969/g\nxURFk3KS+yMs5CgAVJN4dZGkKgARFRYuab7gMGawsMwiXudP14XWGNdW1vnv\nwCrD5s3YyBWJZt4ZRcoNR2Hr20qc/NAy9hYVB7pO/s5hcSgilKmViLSpYGxk\nThMWU3aeQcjCO3uMJaklUuhuddDifB7cIuWXUuHCWcKzb5JtTR1qG4aiWLCU\nHFVj\r\n=Q35Q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE33RJ4Iass2LlcfbhgNdI0BqiyYiPhIDnv2RMM1YAbFAiEA0RDzEfFzrxeAGehEF9kOnPdBhPCI3KvADAGCBBQSO8I="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.5_1611128980864_0.23587499353653807"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.6":{"name":"ipfs-message-port-client","version":"0.4.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.2.1","ipfs-message-port-protocol":"^0.5.0"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.143.1","ipfs":"^0.53.2","ipfs-core":"^0.4.2","ipfs-message-port-server":"^0.5.0","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"2f526025a3603026553b320e050e57e2ee564562","_id":"ipfs-message-port-client@0.4.6","_nodeVersion":"12.16.1","_npmVersion":"lerna/3.22.1/node@v12.16.1+x64 (darwin)","dist":{"integrity":"sha512-RsH1SN2AjLX42D7bnOvuLC/V8K4W07sIKUlFPkpWGHxSjIzhYij6k2NJzUx/ArSwtuIh12v+5dTCLWBoIzlWdw==","shasum":"4eb77bd48f48234ff346510ef05199027beb3d30","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.6.tgz","fileCount":38,"unpackedSize":343944,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCr89CRA9TVsSAnZWagAA/CAQAIChw34fx14bxEsGyVEe\nYSNOXmIlN7BWFC/6zF/zOkxS7nfNSTgZxlerUdsIeanqABs3DtXFcZ13fiWL\nNAJNFiCbCwnF7xH6jAeBfJ18qYjGcdTNkmCacfMZeytiHEsY2xUgK88wVBqN\nd3hc3q8CRJ5PKaaxhXrFo1hrczM0fOtZqH3vJwDyMwV4s8+zEcpE6JC8K6NV\nDszcJ9WMVPSyRiXLmLjjfvKuFz5syzJvBwFG6zkFPThA+Q4h5UEqRlaIs+sU\ny+p4I308RGla64kbzlTSjWXFABivg/mW+FT8dSgG1rM7ClL325TRj6lCRB1k\nlfwIFp+UiecXYgJm/mFB18FvkukeGUMOf4COoPhPj/LflzWG14Ha6cvEH2jU\nCQO4pzom+VCNGaA+e/Z2sr0uteYm9bsCwG9tVyaVLsf172t8iE91zoEpN50o\nMEa/jB9ZLmHODoiLmcr+I73TVorK8CfKuefLimcrHRktB/5qlTZlisMPtMjs\n86AZKCsy4swtyHH2G5kg2k4MsHSmzHdb2DEhXRZeJ+n834p6C/OQZa8MKQGI\nh3FFyBnGJIYocrP8ZEPK3kzrTsT3uKbvC2CN/FXgQ4jimkrtnoBb0frqeZAu\nIuraXMkkohBzbi7Ol4JZkoNiDL+M5oi0Tx52JryJH9R8N6pEGf5zD78+LvN9\nCwqV\r\n=D5FA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGZQ0F8aQlZ143wmwBEg3fBC38IqVS96+uBr1AvOXEsEAiBQJbDmc+LebVC0bpEOef6SMlgmUzGCFpUZ4MOngXAH3Q=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.6_1611317053455_0.7457447587765478"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.4.7-rc.3":{"name":"ipfs-message-port-client","version":"0.4.7-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run build:test-worker && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","build:test-worker":"aegir build -- --config ./test/util/webpack.config.js","build":"npm run build:bundle && npm run build:types","build:bundle":"aegir build","build:types":"tsc --build","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i typescript -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.2.2-rc.3+6ae31055","ipfs-message-port-protocol":"^0.5.1-rc.13+6ae31055"},"devDependencies":{"aegir":"^29.2.2","interface-ipfs-core":"^0.143.2-rc.7+6ae31055","ipfs":"^0.53.3-rc.3+6ae31055","ipfs-core":"^0.4.3-rc.3+6ae31055","ipfs-message-port-server":"^0.5.1-rc.13+6ae31055","rimraf":"^3.0.2","typescript":"4.0.x"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"contributors":[{"name":"Irakli Gozalishvili","email":"dev@gozala.io"}],"gitHead":"6ae31055d21fbb0243bbb17cc697ebe18d84acff","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.4.7-rc.3","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.22.1/node@v14.15.4+x64 (linux)","dist":{"integrity":"sha512-wDHstKrIEp6YPO2JMHr4nCa37jc1GthuqXLpCmTGVyhm1LA4f3OXm7+J2doHTKBjV4Eog4d03HZrv+Fsjm7zaQ==","shasum":"e74f4335ba5f7e7a7d8c2ee4a8918bb672a60ca3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.4.7-rc.3.tgz","fileCount":38,"unpackedSize":343555,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgFRQjCRA9TVsSAnZWagAAQ7gQAKEow5FwkqF255t8k1Pb\nS26gtduppNJTc4bshT2sF6A98UIfFfogIGWGeLp7XwJFQclbymrjLDp0ERVT\nGy6t98aDRiZzRhk4WxB/wovipM3DkesCt5VkY1CYvTVf97ynN3OTSIOG4ZO4\n8RpR4F9OjvqPcTSRSkQ+dtAsJsqT6rvHEfh3T/2693nXEz9UGFANk1T6l7DM\nsiKH6YNEZ3NGJOFzmgE4hkyeAMO0C84q9/yRsHtxV4zXDeBc3fzk9/y1lXiL\nR8KcdyOc69WY/9CmiYGewmJ8C+QJyH3nj1yEtVY1rnF0Tccx0lioyuFjsrtW\nlXvNUX1YFiLLi0f6dTFcK0Fd/k+H+XKIaaogzs0aeap2ax1cx2D/FdW5c2QU\nv1ROU9LVqMOFKfIn6m26WsKTw+fxhzfCptS8S2B9mjF7uo7iCIvM+58qLrxm\nyddTGwc4iA+7rfFp8u49ay/inp+kJziVuwjQQ/MK934lYXJLamYB6O0Kvsgh\nnOCCl72B7IJR7YW4Ygqie/PGe5FnK/Rp5dA0+7wil++5Rb+15tp3ALdgFIL1\nWNXVdBkHVmehNILKzAeAe9seroSX5ph8l9xUVL2vt1MOvy3dx51E8y2jSSKL\nxpDb9uTuqSC4vZu/a9gRWC+TkBXA46ns8Urk0lNDqx1+BDqKvlBZr/etcmcn\nyHjn\r\n=Tu4E\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD/1Jb38qZmZcwXEzk4+J6QoHml7jouQWp5u8RiyyL1EgIgMYyA/71tFtMOFQ1mh8WB2s2yANqdHQrohhPW2/p8Ou4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.4.7-rc.3_1611994146770_0.4936634684305592"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.0":{"name":"ipfs-message-port-client","version":"0.5.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run prepare && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","prepare":"aegir build --no-bundle && aegir build -- --config ./test/util/webpack.config.js","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.0","ipfs-message-port-protocol":"^0.6.0"},"devDependencies":{"aegir":"^30.3.0","interface-ipfs-core":"^0.144.0","ipfs":"^0.54.0","ipfs-core":"^0.5.0","ipfs-message-port-server":"^0.6.0","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"91df29245562d5e9ff653e09b54cd2390538e64a","_id":"ipfs-message-port-client@0.5.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-YxeXLcAeclIObPyBBEHeZQ0v4HV27CpDA3gmS2x+j6Y6j94PycYRntX1iM1Y8iP2V1B+xUKeWa4xSt65ciFrKA==","shasum":"774b4b944c44cfc7243eb29d99e3816dde35c2d2","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.0.tgz","fileCount":38,"unpackedSize":11216418,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgF/VFCRA9TVsSAnZWagAAOz0P/1efYCErrwrNEUy087/Q\n+jTKuV9acmDG5uhIKB2lm6RHfvEFD+3mXg5HjC0bANIAxoRn/8UyScXpEMT9\nqAF7LR/c4XvWaoUdfnK0JdkUtM11H0WnHCElvqKQA+vcF3hsuiSOnZSHq0f9\ntNveBzHvYsec7ihlR6RqjDZr/cCwN8YAzelJoUJGZ7tJN3BzoZ9jkqa0YDR1\nixv89TLBXAFDA1/P6ZOmdA0g8r6fOSDZ2AqFNsds6amUlJ8eP2G5qPubxnJP\nYFpDhCY56EURDW+siGhU7Eg7iN8mKvYRCo/wB06+MUarytbBZi+Ko2OIya/A\nHTfW13BfpWr1vLN7hW38w/o9MmlkD1TSeaIbBdovkEd3c11s8Jz0b7W1Gh9i\nfACmSxaqYnTyg0YKa0EtG5Qi/g/qStPNUEdIHb4wt8y8+0gNe9n1eFybgJc9\nO0RQruHqeVzTBYULsjfNJKkSeZgNuENHKhWSPuowbjgzIf2lcMMEiYCvmRqn\n/mPcOHMfyEv26O8oLfu5d5sIvWvNXeaSrXJp8CCsBZmIFYikeNeZ7qvhv/4W\nUcsUUotxIEmEGp/x7y/29j/e9eVYpVkBE7aNn5/zaZe1BX+z3+QrtgnXBtKP\nc8L8vmkWoUBzAWMSoAll6g3QEMYpiqrjqfeFOA6udeUDb4jGI34W5N3Gk8u9\nT/a6\r\n=+D/g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDEoWG8JxvPpRL8adCI+nYphqp4rmivztKQSUB+0nOliQIhAJLKh+W0PXAXlTfqSiC2sLjkv1se+OOkwHPuFeGWN5O6"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.0_1612182852535_0.4249566957773401"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.1":{"name":"ipfs-message-port-client","version":"0.5.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run prepare && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","prepare":"aegir build --no-bundle && aegir build -- --config ./test/util/webpack.config.js","prepublishOnly":"aegir build && aegir build -- --config ./test/util/webpack.config.js","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.0","ipfs-message-port-protocol":"^0.6.0"},"devDependencies":{"aegir":"^30.3.0","interface-ipfs-core":"^0.144.0","ipfs":"^0.54.1","ipfs-core":"^0.5.1","ipfs-message-port-server":"^0.6.1","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"10fc290deca311263a4db95ec6b9e9ce132d6eb7","_id":"ipfs-message-port-client@0.5.1","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.22.1/node@v14.15.4+x64 (darwin)","dist":{"integrity":"sha512-A5uVgpPBD9TeM3Gpa/cy0cRFv8fvkEK8Tj79KaLa/QNGu82N3lwFNGjb0ujrBZFV1/4Yotj9LDmd7H/ZuPVGZw==","shasum":"f7ec6242515d94177f3b74e441d7c41f31adfda3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.1.tgz","fileCount":38,"unpackedSize":11219045,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGRgOCRA9TVsSAnZWagAAr0kQAJvxTmKZRCgwSTkKcJJz\nAT0f6habo6EGIs0Kdm/Ps2hZxfTcludWYwYIOxA1GH7qBeBsO6qgjT2UuwkK\nmoroa0Rz0uLEta0z8qbpILisayt95FJA9sHhUUYArjT255y811mVP8c3NcSO\nztvuf8JUF/xyY/whUQ3D/wXeTdyj+85choLqgYkE6Kv4NV8pzO+Sqg5mXxOV\nwspXZk+iuNzDS7uoNP1JwcqLKwbSBmF/Ua1hwhGECDGDKxDebDwh2YQW05D3\n3y2i58pvJhWDQg12BFW6e8H65GyJlnu1W4j9/JxZZAXan2R+SZgEmx4Pt7/W\nrX69rQq+ZeIBiR6ye3X81Cwx1Qw1jffVLeq+nfzI8YQsquKfbsJpobpo2taT\n0J/cdLA38zdI3RnJSji21Zp1KttONhq31Y/Y2O2zyQe1q0do9IfUr/8t0hEm\n3o8nfSNrV4UzB+An/bLOswh4+I7BNyVn/LF7iXEeuvjZWDb94CRZjU7Ql9wy\n37d3kCPV0VMJPX59eH4IrUHfZpiZJ/oiUMBHyW9BsmAa5mOVkvlAs0EU8Bkg\nQ43g61iL7xYPk4ghbcmcVJVc8o3VFVXLIdaqGiUP66cYSUEmHgGLCrRk0NxC\njJvD2mkz/90wFuNwgfktHdhGBT4QRm4pnF349lPZf2Xi0+kT40XQ1On3z+tq\n4B6K\r\n=JZ9o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmDO4n3Qrjy+dFh3J8fWPYlJiWn1wnaKCda4svexRttwIhANdp8lWzqLDj9n+PMoQPjko3BFkYUetSrqOmHkAu20no"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.1_1612257293587_0.7474663938422006"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.2":{"name":"ipfs-message-port-client","version":"0.5.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run prepare && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","prepare":"aegir build --no-bundle && aegir build -- --config ./test/util/webpack.config.js","prepublishOnly":"aegir build && aegir build -- --config ./test/util/webpack.config.js","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.0","ipfs-message-port-protocol":"^0.6.0"},"devDependencies":{"aegir":"^30.3.0","interface-ipfs-core":"^0.144.1","ipfs":"^0.54.2","ipfs-core":"^0.5.2","ipfs-message-port-server":"^0.6.1","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"ff76e7cda441d66d327e03e3ca1dea6e901ec918","_id":"ipfs-message-port-client@0.5.2","_nodeVersion":"14.15.4","_npmVersion":"6.14.10","dist":{"integrity":"sha512-atA01kyaDNd5xS/wjOt4Q/MFEvWxEdSSse0MVhFUjmNU2rCv394aFlxAjaEdQ57Cz3fAghZHmayMnQ1VFz2hTA==","shasum":"fca0036fab2a6cde076289ade865dde87ec79830","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.2.tgz","fileCount":38,"unpackedSize":11196054,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgIWDDCRA9TVsSAnZWagAAHxoP/3co2kNZSAeBH4GKbY1J\nCiw5NizAzAwNYh3mY+nmEbeT3yyDzFbcS+QZMfRGsi4L8pvHxL1zmRev+TNT\n4wrS+5LXUH7RFi7Hbjf3GI4kZo5mX0oaH8QLQSPD7n6EH9nltI6WC0iPzzjp\noNA8Vz7+9/EQ7iwB3am17xDNQtiKqMo0bt5Z5dupwTfLfqYNVTbtsDKHB+8x\nlTNWP6CXcTiAaZmPpTJfh/hf0Hb+FXIkHfG5bWyBw7D2nhp65UaTSoEPeo/U\npPICzCuCdL09V6MMnNGhA/T0Lrx3Vt2G/ksyT/x0ppE2t8nmxj/FkzlWUZXI\nLnXAmTvY3SVYos7/ooQn+xlVLJMB0oSUQgFXpI+w5Kj2w9kJIlTW7Dltfj31\n6sPo8F5xF4Ep2pkgGV4Zxv2WV2/KHQWIMRHjh4BmTKtPpF+z+vIjB6jV32kL\nV6PomhAWoF0yGWb0+y+Jot6AgHiocgqYwDIMtay24ewVPikkZHyIrljmh84d\nNNV0Ohphdfuy4ERw/vSeo9cxzv+usxstEAYd9SY6m8uyJuGMk7rUitPoakIf\nXVNjjOpxSOc6MfxvKRFYhZbfzGq7m5BD0bOntSippgIJx1AQpq7Yic9+3/ns\neTSx51dkdiBWfEGsCNuoF5FbuylU3gcOt97mZWndrTuj3dbsxNp/ZW1OovY0\nErj5\r\n=J59x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZKgrP/gSY7LE68JBPVz+qq1x+gIvV+K2uXRF4if3bcQIgbNYFnoko4aZNrk2dpqwgkQEmnZAHShgAU8gWMdIYx8c="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.2_1612800195205_0.6648698548808756"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.3-rc.4":{"name":"ipfs-message-port-client","version":"0.5.3-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run prepare && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","prepare":"aegir build --no-bundle && aegir build -- --config ./test/util/webpack.config.js","prepublishOnly":"aegir build && aegir build -- --config ./test/util/webpack.config.js","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.1-rc.13+be0c613c","ipfs-message-port-protocol":"^0.6.1-rc.13+be0c613c"},"devDependencies":{"aegir":"^30.3.0","interface-ipfs-core":"^0.144.2-rc.4+be0c613c","ipfs":"^0.54.3-rc.4+be0c613c","ipfs-core":"^0.5.3-rc.4+be0c613c","ipfs-message-port-server":"^0.6.2-rc.8+be0c613c","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"be0c613c0e413077bfccfde0345b1ff2471193c1","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.3-rc.4","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.22.1/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-F7e1VrWogn/TGiaTz1BbcfNvcqzHOFLsEQpva5ABTsEnleCF66tmvlmZTpODyXRoNckp8PIZAYsRwLvt67CeMA==","shasum":"ffab584a67b9b5d3ed5ba759b137fdda91d6da5e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.3-rc.4.tgz","fileCount":38,"unpackedSize":11147343,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgMiTyCRA9TVsSAnZWagAAOCIP/1u89923oN73W4QIUNpu\n+JpG2CtoXk70FfubPWD2DLCEXMU0kfu4Gql3DvxlrXirzlVAhrx7nyxWLiuS\ngOpMLyTP56quFMF1yM6j+Q/otO87ARZEdiVXGvwSPJJQoxlvCeAkPsEj6kA2\nD+6Yl5xSvyk6Uwr2xoGVvh5sl+ptOq9VHMRjkqswEAn0rzGEQywdcr/FqdM/\n1/mK1yrNudJfi8IsPo7X/wZKYA141GCuvwDhklln0hPTP7Pqj0rpDhFvFGYc\nL4ZbUrQz4UrUyr1diEOExS+eYCLOj4oWqNr5zNqzCUwwaBj0NcL6adfdqS+a\n7/k7vS7YNkLm7r4JVXrRN978JCK4Yg1XhJnTTXsANwMCCa0XlazbJ1/bvEsL\nN03uji1+mISzh2zVHEAAXSghYlrehiMy/WNqY4wIElz0AcjKSQyE/H2VUQDP\n3OdhU0BrmXLCgjFTmpTEnP0RfYoFKY+NsAAiU/rvhFZ8MmcI1KPCVgLPCGLU\nsJf90gPXxbwuIrw3aSbNNrHxjJIm0paW1RZkDKt9WTtqjU9uBWrgSfDq3u2c\nQiQrD54mmPidPu2Vqajb/p5pdnaZ+EaEqHVKsuyT1eCu8xkoTCwzHVBI32LH\nj0ihCtDeW2xt2g63A5N5+EvkIxOL+807F6tWa7feUfnLUfZ0DY5WvxRHKiGY\nx1eT\r\n=XlVa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDm/scRO67Eq0z7DlLX/WnX4iU9LN4mOVwafFZN2K1l8AIgUc4fX02WO9Npoe2m1N0YZIkkyoP3zYOU2tnCYmphN4Q="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.3-rc.4_1613898993646_0.8003891067592179"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.3-rc.5":{"name":"ipfs-message-port-client","version":"0.5.3-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"test":"echo 'Only interface tests live here'","test:interface:message-port-client":"npm run prepare && aegir test -t browser -f ./test/interface-message-port-client.js","lint":"aegir lint","prepare":"aegir build --no-bundle && aegir build -- --config ./test/util/webpack.config.js","prepublishOnly":"aegir build && aegir build -- --config ./test/util/webpack.config.js","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.1-rc.14+b7659d45","ipfs-message-port-protocol":"^0.6.1-rc.14+b7659d45"},"devDependencies":{"aegir":"^30.3.0","interface-ipfs-core":"^0.144.2-rc.5+b7659d45","ipfs":"^0.54.3-rc.5+b7659d45","ipfs-core":"^0.5.3-rc.5+b7659d45","ipfs-message-port-server":"^0.6.2-rc.9+b7659d45","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"b7659d4544fbf335eb5dcd3b71fc1b81f436088c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.3-rc.5","_nodeVersion":"14.15.5","_npmVersion":"lerna/3.22.1/node@v14.15.5+x64 (linux)","dist":{"integrity":"sha512-YP6Pta6jdFoKdx8FgS5PnOz7gvNY+CKAn4BsHtgqcSbFmCk6mPt2xbYANi7ylXmipoaSDO4QmpfbwhIDnrcPFA==","shasum":"9068fbeea76e85bf77d4ba0187d149112afbaef9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.3-rc.5.tgz","fileCount":38,"unpackedSize":11146511,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgM97LCRA9TVsSAnZWagAAokYQAI9BHqWHwDfDN4bJtYtM\nrarpucP0sQbPwxGs9s2lE+nVz975JvR/ezP8zsEjCrEi6KpOw9FPyj37N+n3\nTkKSAMwRu/oFQOPEpSPf5oQkcxCo5IsMdNgbXXV6NLzwhWEr5pyP7k9QjDKM\nv8Rnu4RU/sQoRFqmpzLd3b0LpHtBAWsHNx3+8hInwEWidwlvyMsUn2yBChqq\niYIhqvQPpeHGo7Rm3q8F9AF3g+7CcYbv4Whj9ColHFe5ckbs7M095odVBuA3\n1XLfYYQd37YvCRXMIh/RpogDerhKOvR4D6GMGXepV4QkI+KYY/kH9avRL2p3\n29S+kPtz50r3ZO9gyDbCgJsScgu264+OQUQBpqGMfGGsSpRy4qrFLhO07eAJ\ndh4QSsxEpf7htQgjGE/S3QyXwlOfTIYJte/fTg5qVoJu7lp2cRvCOk0fP8fB\nd2qEF7rJGxLovpO9/h0HDz5ZqeplU4MoctQWtd4mDfBdBwmkWdyHBU67s5jY\nKwMpv+CnDpwDxd8WrDZp8inAV+ESgQp1rAbingvWDMfFp8vas8fUwVPI4g5g\nWmna9rY4+l2itMYC2b+Cvv5qWTcHt9vyquAbDEoWTZO/hOq9RScQG+4HoEyZ\n1W+6LRWf/ZQeZuKu+WC0+0kuSbaxA/0UFFn8T7MpQdB5QQgagj/77GoVrUxb\noSXA\r\n=PGA6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICZCRa2EucG+b3r00Rvi33KueE/Y/pH4vw2HKRmrpB0FAiEAxHp8I3qcphhLYaYDPZX78REScKGdFhLo6jHUyA+u5ks="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.3-rc.5_1614012107526_0.7354188751865522"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.3":{"name":"ipfs-message-port-client","version":"0.5.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"prepare":"aegir build --no-bundle","build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.1","ipfs-message-port-protocol":"^0.6.1"},"devDependencies":{"aegir":"^31.0.0","interface-ipfs-core":"^0.144.2","ipfs":"^0.54.3","ipfs-core":"^0.5.3","ipfs-message-port-server":"^0.6.2","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"0af3b76115fce61d64f0f8be90cf13263d2a12fc","_id":"ipfs-message-port-client@0.5.3","_nodeVersion":"15.11.0","_npmVersion":"lerna/3.22.1/node@v15.11.0+x64 (darwin)","dist":{"integrity":"sha512-bkRyaaz3cjNplQJRXh95sMIspjowlfYlXtlaOHPS7ONAIINHVFnqm/4tASUMcgOqXS7dD0U4iCJVaAcKd6Eqzw==","shasum":"18a859b67b44d2d61b67dc53144c74a474a8e618","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.3.tgz","fileCount":36,"unpackedSize":93334,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgR1I/CRA9TVsSAnZWagAAubgP/j5d1oh/POwbYBCGTdo8\n9V+X4OlBW98Vlg725Zjldi9bEH8soa6VW+5u9y7j0YwWb0w4hhwkzlHqJV+8\n32q5/DUYpAodCrIZMA8tBGctP8XmRghHrBmNQXnoSbh6cDGRL6DQzKHzEeYk\n0w+JbgHYT+05mmXwJYW7RjICSdDCo0vqPzzDAE3jALJf/ef4LVTl8OqG7qnT\noWAuoBegY73htE4MsMZSzG1Cecz85x4ZLN73s3Lkb4818FdJ9mWJoKO2UUHX\nf0c90E0RxIzntd/j6r97cVAVTn7I9VCmCTKXxnQEjifEqifaMDqBLBijTjhc\nfHJ4flbvSceNhhv4JxWaFof/ZW4azTl8W2BfNFaj3GIn185y/LifCueIr6v2\ng8j3i3kq+rTAB2s1YrOX5R3qprcs5tQcHbGa/R8zKyWqxi1GgUUAqRJNIkOO\n8MJE2lwx9IGbBnpoRjdqGJ6tSHali6I+gAI7bxdFvqNWyy+m2aHwjZ0KUvub\n/DzuMpOpGDPQW8eS+gbKt/p2HY47J5gdNDb1ixO4AZrMaACk/Ksy/TuGsuHH\nRYQk/ae3caGAjNdWmyCjYp3s2CYfKOTKBTPxn4F5BA4ulWELWR3GRGKSeCIB\ncIcoew5rqPpuhm5LbTgJTwQG7rhgfmh2LuRO6VVENGxD925suhSAdZ2de9bD\nV7U0\r\n=zE0M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDIiuswupDWGHH6hLYkEuLwkKvuknsAuP+eOoDk/aPczAiBnOjh95fhYa0PlV0X+/2rkD5sX6nN3o/nImNe2OzMu4g=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.3_1615286846881_0.8314478374263161"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.4":{"name":"ipfs-message-port-client","version":"0.5.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"prepare":"npm run build","build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.1","ipfs-message-port-protocol":"^0.6.1"},"devDependencies":{"aegir":"^31.0.0","interface-ipfs-core":"^0.144.2","ipfs":"^0.54.4","ipfs-core":"^0.5.4","ipfs-message-port-server":"^0.6.3","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"511147bedd51be3151de44a90fefe9425bfbcd50","_id":"ipfs-message-port-client@0.5.4","_nodeVersion":"14.15.4","_npmVersion":"lerna/3.22.1/node@v14.15.4+x64 (darwin)","dist":{"integrity":"sha512-9zfFGfLPggX+dFVIII+xDbF7b6MCEfxLnAaCKfQM1e5k1HtTlGz126mDCQkKLdCOovrKcibq+d+hDNr+9cFtow==","shasum":"eb85322ad2fdfa5c49d0f8fbd59453590b30630a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.4.tgz","fileCount":37,"unpackedSize":170490,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgSKnICRA9TVsSAnZWagAAVDcP/3W02E89SXHtA4onI8DJ\nBsAUt29VebG9uiZAvnGW6vfCBXW5vIHd2LbZcUVpfaHQ0dPM96UqGUNEVrMs\ndLVfFCfof58Ak8ugwgkbPlLPeI/4syl/EVj27AYxPXKHvaimXKUTN8Mvgai7\nkUzG16uidoXwdZ23KU6VEm1fRF/k9fQLuXklgxlwISiHtm9C2mW4RV6r+hJg\nacwSEzxwdoiYpvg/YSS4nO1G/kxnR6ukyRtULkvz490IL0pxRoHMyciK6PcC\nk2cHT7EKizlm+O6E2Sr7gd/SF3L6Gp88RAsD5BQAk8rfM/DLJvDCwFt7DIFM\nT9o8Ka7BFLBiBikBBXZzL/7vQE5phxH8H6LYH59zbRNdnWuZOQcNtdYLb3vK\nDjFZKLM/KVXUObzuHCNnyM7p3leE3A/NDKEGJPREgITrJxZOCRfiJZPnJWsS\nZB0yAxbRCgWe2VjnOupyivFYuPvRo5Wt6YVI77bBVmLlRihdICJoV45ZcqqZ\nqU9slUJ3Zh/5L6QwfeAE4LH/CRwAGkkN0tXvnnEDRgCT+wIYr2sNcOp/PzT9\nIYIVzuRGOxzhBo+wSFhEoI2dAeUhjOo4Pq4V7J8BZ+0FqVPA/eyCyUA4WZon\nko3FyJjAtIshLpcXXpacnGsmptb+iIOj07ePHmgCrSpFB4BDnUrMFvGgtHXz\n+STc\r\n=Qo4L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGVTNBfmp007KdsZaP2BUXwvIbUIIyfMeyGgfDyccJuWAiAYQlPxVfPkPALmzVAlm7KnNzOUypvjGfcvV0vhckC05w=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.4_1615374791769_0.04272471679109424"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.3":{"name":"ipfs-message-port-client","version":"0.5.5-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.6+1823375a","ipfs-message-port-protocol":"^0.6.2-rc.6+1823375a","ipfs-unixfs":"^4.0.1"},"devDependencies":{"aegir":"^32.1.0","interface-ipfs-core":"^0.144.3-rc.6+1823375a","ipfs-core":"^0.5.5-rc.3+1823375a","ipfs-message-port-server":"^0.6.4-rc.3+1823375a","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"1823375a17ee2562f06accdd605eeefebf7a3922","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.3","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (linux)","dist":{"integrity":"sha512-i0q0/85L1hMrcJSRej5MaTT7XyVOEgaPKhLWQT6YDQDjd2rJI+X5SWYlznI68WHFc2VoFIhTd+dg1yiO/MgpMQ==","shasum":"52edcc87426d51fa010a30361521a8da404910ad","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.3.tgz","fileCount":36,"unpackedSize":235397,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgZJJLCRA9TVsSAnZWagAAt9cQAJYISf08XJ3OFP3t+Ru3\nCiMJRCBFUnhX1u5pFt9dPMetCJuYlHRi/eFnVI5ifs0TYvQGtRnRgU0n78pH\noislIt9tB5MsdMwuWm1XgbAFwSTNbcsdQzdc+NWAxR1/hjozAUBSysM5Wiu+\nOUeUvTmXOwyt9x2qMaIYHLzKqxr/WcvU1E5KbR+JgjrW0n/2Jbxp6syGNzpS\nmho9xaDBal6qJuHkcgMOaoGsoqpEiMSuzJaYlSltGUknwvzH9erPztas5u6P\nBIuswcmiZJkJdaVuSUD8XOZEejZKHfUukyuwI0lJ6vTQdTGhMuwdL5kfqBYS\nOkCMmaG2+DQKGV8pZpFz6Pwepn0MaRA4NpGaZBmPUJKCPITFkt3uyFcv4fpI\nWVYyB0Ye2EG/kfal67hFbJ4VIItvgYxkNF79SdoTadQhyFk2Y2zrb1SUwD7z\nl2PSppEGKGieHRSz+zdksXbmqC65ARkEISn03mpu3mtPonWEU+uyK2goC6H+\nJwFGsu6McIt+vLkrw5w08XGQoQCKzLbAPx4KMgZ6hgJcgov63pJRR73+RR0C\nyGAdd13YZTP8BgKvsrGAgQdav2D4+g+V1tAWdw1MCDG9vWly9mTWBHyW09dA\niY3PicEOrn3nIukdfjXdAn+oejMmZDUl0bUFy+71aBmYBMG4FuK0uJl/WOpn\nQPKj\r\n=MC+H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkLDz++JUxaFp/yVF+8BnqItKKZe/7qyfvkPbjxm2NtwIgTuCsR3gyKFkvdf6NXpCVdg7BlgKRLHBL0qFPOzavLmg="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.3_1617203787015_0.7064219443176811"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.11":{"name":"ipfs-message-port-client","version":"0.5.5-rc.11","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.14+e7de593c","ipfs-message-port-protocol":"^0.6.2-rc.14+e7de593c","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.14+e7de593c","ipfs-core":"^0.5.5-rc.11+e7de593c","ipfs-message-port-server":"^0.6.4-rc.11+e7de593c","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"e7de593c9fb74bbb82731c9ed41ec5204b18b1f4","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.11","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-9+E071gZGIpxT4wKKFktBZoXJucGujeejI/0Srl9Nv22HoV19fRiPoK20wHwFrSMmveM71wdSkfCoQVyIWxFAw==","shasum":"89db111d39657bcef559018d2c5366d915ae3c77","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.11.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgiVIhCRA9TVsSAnZWagAAPp4P/jaam8lmTNZME+64jU10\nulIeSfHAjqhrx8FCr3mu/4MMdo6hsQImrNsMA0f32rCdnd/AntzFbWBfwn5k\nPwXg1vqI77WncABYYoc7hZdsZDt8PBIJi4Ut0R6dNLegFGyY1HaElDdRomlK\nBYwOXwhhsaripOHaaZfE3Liwx0pOP8L6NA5VBq/4ADBggG4wzR5AThibzliV\nnlT6nkTkI1HdZRCnrfpbi6uahgbxdb3+Zej4uaqt9aU4BefaVOTe1vfrkcG4\nQCJMSSNat5ZRfK6b0lgqvWRYA6T28/1CtrXomo/99p22WFVSdvHfvfIswpyI\ndZijnyY54fgNcHFtKjbXxrMG0HrtKEt5AFRVu7VNGV0A/C1jFzIfmNZhxoUN\n0Y1OxcxAjYdcbhnr9TK6gkpZ1AzTGLnb2FWTEh4yyVqbctW/Ev2BbvIykNfL\n/Rf4xDoJizN/+C9yQKQx7MIMzOphl2VYbCBS5s9wLm83sts5/qXIyNs90dbr\nRsUruco+1QKcG4KLfYOCTJvd3kOhTiD8VMLXJ8aWKI+1Ba6efZnsuD+UaG8U\n+z1ZI+tJI0PaxZF1o+HgzlTr/MW9I87wGEyi9yCuK2hxEvE46o18rB5DC91t\nW1q53P9rbQC7I7Ea+YgBVn+S1z658P9HONNx098wa44gQOt9+b5hYGoGIMks\n8ewS\r\n=1DSU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDLCCwM2wscK7nX2bveoFVyDDc4Z3CsFUZ8PN3F9JgXvAiEAteX3AZ9Ab8zSip6OqFHLuzmyK4lXF/vTz8+8S5+1gEU="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.11_1619612192810_0.931452800057496"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.14":{"name":"ipfs-message-port-client","version":"0.5.5-rc.14","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.17+12915f70","ipfs-message-port-protocol":"^0.6.2-rc.17+12915f70","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.17+12915f70","ipfs-core":"^0.5.5-rc.14+12915f70","ipfs-message-port-server":"^0.6.4-rc.14+12915f70","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"12915f708057c54a08ed0b1f6c417eee8d65ad44","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.14","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-+Gnq/BpalR6vWMRDVsGPFkNN7HYiGsNrFXAkgB4zD0mJmPp9CyVOkWLGjHNd2u646vdt6AFY0FTJfAudYxp7Wg==","shasum":"c43c4ebc5a7bd1e097284e578ad8716a3a433d04","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.14.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgiZemCRA9TVsSAnZWagAAFDYP/ROwZKYzNntI2jrvGnJD\njLP7K6ljKfEnrBp27dQ2FqLRQSk0oxnmzrlVMaBs6FJ3Cp6fq4ueb5lJMkl/\nQ67Z/cJMLDanh7L9ldWGcWhgqSTLKe9cul5+BowsoG5qrfCR9p0kjtCBYAYz\nJGkVh7ifLXw/4NPIZIxQ3KET6nLw1GcBILC6T43D+kfmxYNCYc5jmxKISld0\n3epZslJOj7ZkZsMoDg9Vi3LPbx0GNgIGFAPrh1C1TKHtqy9wU1DvtJHKR5cw\nUdwwz3N5Iwcq/cWJcE0z049+SnM/3n5/yW5whQKQk7Bu6O5zDK2NS754j5HA\nzYHHgkfRaTPyv3jA+t78erObwMMhnsd+T4YmYagWo0EV9DIZHGkTXXtoFVyw\nHHEV8vmrZZmx7xAo6O1m/E4i/iAcbkl62/xWe4Ym/MBXPAMNGTKaJgNMvvr/\n23iCZO2Egq76K3HPW+mRdseqVDRqohQzRtHB3OuCUQHNSPjROt1kEnCr9WPO\nKrfv1bB5Wd42e9pJbkfuen5/J4SFEOqQHoqRQSSY8FyNxXZmf1rIlbjDxo4v\nIGzTuJbfbIIF1IGyKyg63b4r3vpvk3gyTWntxI4tD3p5h0sj51W5NI6Knuvp\nUUJ/s2NIc6AhLlNSWmTFnSowjv8MIMUm6jwMr7qvN1PpAnwnH4ey5fHblcYR\nV7vu\r\n=VGQV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA6FdKy93PacaAg13X8RT16YKeURXjhZgQU6ZSgem5kbAiB0vKWU+BlHHgesPPba77X0x9OsCf6gEQ8hyGO9/mSA4g=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.14_1619629989873_0.6114436206783667"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.17":{"name":"ipfs-message-port-client","version":"0.5.5-rc.17","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.20+99bde7a1","ipfs-message-port-protocol":"^0.6.2-rc.20+99bde7a1","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.20+99bde7a1","ipfs-core":"^0.5.5-rc.17+99bde7a1","ipfs-message-port-server":"^0.6.4-rc.17+99bde7a1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"99bde7a194e5918933e589d685dec222b083ac42","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.17","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-Kz8UGuO5mLdWTew9RygTLgeLp8pjJ/AoAisJ6a1FOTB/6DKwXQB5Kaoe4LSqlx8N92yU/o4OY7IFrgsLNIkvLg==","shasum":"cfa5c82fe55be5a955687534852e0d414adc7190","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.17.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgiuVNCRA9TVsSAnZWagAAvMkP/jmXeOiN2g3nVVoqZ5P/\nUfX/419uPPk7Y0leESH9eSulpehg7Rb9YfWJjhynt6LIR0Zi9O4rH4+ZeP5d\nj+GbFydcdetJJKXHlX4S++hjqKskfrg5gr5TvSRdo7i7DYGPLw5cxN45xgDC\nDtgETcd1Ph7lRrsFlGP1OeW0C3Nv1pDNp+qDHbOxLmjPd3jtXaNERaHN/Kms\nM0iio3uC02p/cjS7MdKwsYMwyQEQ+7DSQKBO5YhEbZbKfoHx5kHIDGY7K3HI\nVTAjzBZLzR9Op3mJUMriNeUs4H44H+WPHeLlR2RhnxckD7tMfmonfSagST1B\n7gCgfw96tDz+N+Up+GK91Ne0Tgg2X7d2rKw/6dKk1h7j23NvC+gHeMUs8gi4\ncYFADiXbnBzjbR3wXztWAe9E2gWq0RDLJEU0FICxiKEV6+79U0ex78pnO+lY\nMQQTHgSo9DNRT7gLzr471i8hT6Hj1oWMiFDe4lDXCcBiR11RRA+rPemj4cND\np4Ryh08+za7wfzEtnMlEXwqLj+IFOqmP1fw8470VmnECIfMcHxeaa6OIQvIS\nB3SqgqFaODctfGdTsrKH5UHoc33RcMrovUo5DYy3dSEIwm/PeLL6oXxOxPrD\nbQ1xSsX7w16xm1RhkMP1CsxEBCGAEs0xFi5BgV9Os07zKAM7rM+oDW7uN9S1\nJ09u\r\n=fKf6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB1A42BfoN1cggeCleYB1lfr8jY1RTaPn4t6POOOLZdiAiB/2Bu2pbcilrWW3vWLjbYmt3c6Xxjq/l8Tml8ecj9xWA=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.17_1619715405267_0.8589260507519909"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.18":{"name":"ipfs-message-port-client","version":"0.5.5-rc.18","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.21+2ec15c08","ipfs-message-port-protocol":"^0.6.2-rc.21+2ec15c08","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.21+2ec15c08","ipfs-core":"^0.5.5-rc.18+2ec15c08","ipfs-message-port-server":"^0.6.4-rc.18+2ec15c08","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"2ec15c083eef923096b30dd927801331e97b4f5a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.18","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-BqJJEp16cWb6SJGAPS7Zl2fpa8s254M8ewFNxpnIyfTlAXuKeTsomHjlQ0y6skdHtr6dvH7+8kcmDhqQGvtaKw==","shasum":"e50558673e541d85eb328784395877b21869b214","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.18.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgi8zeCRA9TVsSAnZWagAAS+kP/jun2QqUl31gqaPm1PaJ\nHWb6cOV+1cR8+uvhXSerHDHpPc4oU847aGdyvVe4XNeNfj2X/sn+7y024QZr\n+NJCILA/wdGI1DC0bKzd2fXlMVabsfyktUTxZcWaqWMx1I6X7E9dgElw9pXB\n8FrbWEvluqxyy9Oa50IqMAHLNR6EVGxVo+XHNu3G00b2qcN0UosUxsxKaJIB\nVRm02btyU3TfIFziYLJzjyyg6pQzE/JjgNL0NimMgFTQufzbeXHTB1A445L3\nd7O/3FjbvAyigHmfMTj7jMIxO40hHfEgCuivXf3GLCHpr0dWMg5bkm5izrRH\n8ifRYlYxVbSiGOgV0QHzfDU7OtmL7LPkQsuZxn05qqDXd10Fdj7vJ9hFSlj/\ni4RcN7QXtBTBCWz85xqfDG6+xLAzic8/sQQEkpCV9JrnmHZnI70lF6F4lYeG\nbwW5ax75FVXT+BtBJdFKgCq7fpK5314WExWJcIvvD7wpEBXdiXFtepjZDOpq\ne5WmaFUQKWCKrTwEnT2maFni52QmIxcB+haB234hlJVP6OGDEvQ1b1TF8c0d\nfnbjZXGrRpj5W9Tvs2UQE56FYkimz/+FMAxpik90Ig4Ftcu7cuDvspNHbOUf\nzneJqRX0qjM+hjZb/JTpFo7YH6Jp9kztHqM6DN8jlmK+qBrUMJYSmwPJDFYi\nH3Nj\r\n=MDRK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGejwdQeFT8Fjnfli2ZGEfuN1vj0FWW6+9pORUD/E4q2AiB3qAZePeRREv3+9xKBOUCk3Iblm95yMlJvSserYojKxQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.18_1619774686240_0.11132574187525601"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.19":{"name":"ipfs-message-port-client","version":"0.5.5-rc.19","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.22+188f1f39","ipfs-message-port-protocol":"^0.6.2-rc.22+188f1f39","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.22+188f1f39","ipfs-core":"^0.5.5-rc.19+188f1f39","ipfs-message-port-server":"^0.6.4-rc.19+188f1f39","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"188f1f3930ce2dcea5a4fd6b6b1cf413ca04a736","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.19","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-e78b9mb5mm1Tgivcds3Wf7Dlo5Wffg1BBzy+MBbpHoTqWwHjnjp6BZjCfUe5rqIRTMNzCMWUs/xfoMFJyq0CAQ==","shasum":"903470d249a0c014a5e428b12005ba398a30ab79","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.19.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgjDjBCRA9TVsSAnZWagAAkYoQAIZ8YEnf3c8Zsc9lBKRV\nTHtGmQjBss91rI6mvTRB+TRdhpg/DHDtEHsLpIHspNh6JfGMUCA5Mlx0PUK/\nwGlNN7R6TuE2zAYbkA63RzVcz1KHhgGLAVjNPhUCnqe8hWxQBm+9wxq3p3dT\nf6ytjcIBgk6BncNmV6YLVGCN592CuCRaZLhLljZoIcCr55yhrtNwYsjycv1E\nUyDSOXKU9rMubtlUyKI3LORPSptOcZvmbP/TbLogv6VOHKZUhqVZmKTTh0WB\nIdLRNrinYt3JMCngWLtQ+FUlwgMTigvUNHj36cPc2Cy9IY+Pfj49Bm0xywG7\nmFeplj7NdOwBxQnQq+IcL3cPr5oGGbAHegX6pJKH83wsT4ni5QpdYdEW2qjd\nwA3YXB5MfC0yrfq/esm0mCD6Iz41huttEUkyZibaY99lcxPdfrcJr7Zt5zGY\nlfKy/dqzpnIJUZtrhBvkgTOTMukTWNzuOKV+sp1jQAWfZOEMktq0PoK/uwPk\nItuD/VSmjWycjfzLa2rQKDG9kOvfSXF+oCLLf1CPtL76ULkHolcKJJ3eOXws\nOXWdLiET59heLJ8kXpp2WScOShHXyDYc967jg/06o2WQiPzbfJmYu74RJqzU\nfE4vNqwmEuNoatwo1wUFDS83xUSxygHINxxxKe3hL8Obma/EGWeNHdmdsqsF\n5vcc\r\n=AMD1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyjc4dOEojmwBASBzGSL9Mpx4V9i+DqV2asGjaYeAJrQIgKZawOSO+3o67hM+mW3IYgsWKZEOhRuAa2H0TYH0C+zc="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.19_1619802304813_0.93358533600381"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.20":{"name":"ipfs-message-port-client","version":"0.5.5-rc.20","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.23+1a447f89","ipfs-message-port-protocol":"^0.6.2-rc.23+1a447f89","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.23+1a447f89","ipfs-core":"^0.5.5-rc.20+1a447f89","ipfs-message-port-server":"^0.6.4-rc.20+1a447f89","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"1a447f893072d482d5a7ad148f9232dd43f64cad","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.20","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-h4/o0alCm5TFaE+ScKetAyQkk03vqbIcsrRA4BzEoJHCEQ7kxmjMZdQNQOkZ3wa0vyoG7xC+eTRz7c3S7WhqPQ==","shasum":"e23030c4b53d9a366296916cc7584ae4a7c03326","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.20.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgjZWCCRA9TVsSAnZWagAABpgP/10aCpLJWnF4P26hyHfR\nTr4rCFFdLz9i+RLJMn6S8rwCuJRKjU5TSZiloP7sTUGc+yvHVdnVHdAuUbju\nj6pqJIcu/kj9CH8qwUYlvKHIGaN5wkKW7dUcN5gIyJNYO5C+NteKJDJv0YYL\nOSYiFolwZH9X+ciDQ371qlsx6FryLAlB3zowDG74gau0vGXvyLd3S1pPEwqA\nPPJhsHUWxJ9LzenAsH1zvi9/+G8Uhr4wZJ4/Wp2bw91aLM1PmF7hI5xvsxoO\nU5FDuopoIgbF0dLb0eMB7mC/8evUnZldCETmvnVcbRkEaXacDoQHeh7Ov0ZL\noLCrdGeJ+8GQaW2btx3VCpviqJrceetVuym/ZDxPCU4gOp1WTY9g1T+Nhln+\nboM7dp8QSWiS1Xpg/pnvNdlIaVOIg5Pb0IHf0IQKGt+tU5TmT9OI5zJhQaeg\n9yhon0/+jAlh8sE+ioRWbZzbso+AvqUqx658piwAhn0A5ydEr+De0Y0SAqgF\nkULxYrOqh8fCbt2L4NcJjdkqc/TOYB/aaW2LK72RjeoRBqsZCkzhs9SeZsX0\nhFSYFBZJJ3dfc3EbRDt+76Jk05XIQIDOUuS0rMOYP5TRp1EN4sVUE6Go8ZK9\nKqqq9utHT+1/98Htsg1VEf3ZQBAtugpsK2wyLLEU2D4Tua3kQmGHQnETWiB5\niTS6\r\n=lTUJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgk6A16JNY0ywo+0E8K4SBNeCo6iu2Ol+g3V+K1KsHRgIhAMwLe+ATskUVHWGd04DRSn/t7uO0a95hqxYI2Dwu6Rmb"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.20_1619891585620_0.12575464634611566"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.21":{"name":"ipfs-message-port-client","version":"0.5.5-rc.21","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.24+21b70a1a","ipfs-message-port-protocol":"^0.6.2-rc.24+21b70a1a","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.24+21b70a1a","ipfs-core":"^0.5.5-rc.21+21b70a1a","ipfs-message-port-server":"^0.6.4-rc.21+21b70a1a","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"21b70a1ac38d53265daa52d8c0eef12d4e3255f8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.21","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-7Cmz0hrXIe/rzZaOcs2GJwY2cL9ecSpOdUlWir25wPjsh06BYJZUijWlCS+Fw3ocOs/mzAaysSPqmuv4xD+vHg==","shasum":"0c10775216c008a8a759de7f7c7b6e88f5e2aae1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.21.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgjmo+CRA9TVsSAnZWagAAtxcQAKN8OjRKNFEgZe895EH7\nRPW4OiEZyCq7GOcSb+F4tXbv09wvu1hl/3DCRSchTxE1f3R8R/aaltlQgM+V\naxhHyyeTVcdXp9L60LE4wCa+bC4vurwl6Ho+XHxRzUFnivIZ/rL/FzwRNQ2N\ngNKIvVgwqvvkkA4Kp3Rgqwr5xnTovk9d4FBCecSnXIHwS/0NIqjGVwG95kCj\nyBttkm06QRJBsLvnCrnVZbrfG2vrk2C7vFaoo7g/TrwEHSXrX/Z4vVQJQedf\nLoRo2vClFXzYp9Vu7lYjb/TBy2+CoQtLt1hbVw2bPPVy0z10g6kvBQ0DzFLs\nGfhZRM1DdIwNbfzzpHCihttHaXAJEM6EgLvLJYzO1enEVL5WaS3YVwJ3J0AG\nruxaoBR52xPCyq57NLWd440yvgP5uzSL4+bmCq6C7Y5SUxziumgcU/+eWZto\njfGTgXJlOlWh7XGy133+9unPGaV5OyOmeMs3Ij6U4HxjgP4IlgzdlYIU5OVO\nUuZGXaTRAlaB38nAnCBpVhGoP05qXVQ+zIazaF+wPp25aEL0nyIkfvBq8BCv\nR9mUveLm0ZUAYgQ/3QzFSaaLPGiBBZevfRWLneXwUYt0H8DKlyBRwamtWJAg\nrVlJqXOHcRuy9m23nNYmBmSGInpJKPJ+WEmS3rkmMAYxGB9S/a0hWGPpk47K\n7Njo\r\n=BsQr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICgMeGnpfIpQyZ0CmjsaKyRpjCpatR0ZGtDzkN/O3XisAiAv7mI2JxxJ6W3k3KeevRxoUcG3xpprmMNhkawOWPpU5g=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.21_1619946046213_0.21950821223954553"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.22":{"name":"ipfs-message-port-client","version":"0.5.5-rc.22","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.25+0a4fbb4f","ipfs-message-port-protocol":"^0.6.2-rc.25+0a4fbb4f","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.25+0a4fbb4f","ipfs-core":"^0.5.5-rc.22+0a4fbb4f","ipfs-message-port-server":"^0.6.4-rc.22+0a4fbb4f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"0a4fbb4fa20b17d80b75fc57be49fc8cd7c14877","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.22","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-7oSDXrLd+RI2r7haI18VSzJcFeWA88io6BBmo8+tamnJBwHPX20VUJ2dmd51NLMVLj/RCX78tiXEO1ulYPmrUw==","shasum":"dacbb0c214b9f7648e09a87c7c944c83599ade95","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.22.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkPuRCRA9TVsSAnZWagAArV0P/jIwydL2O4PQAuFpzGJL\nLBmmbBbIiTCWRgKQCMo7m2PWCy4U7Aju6TYln5zZpxlqqUHW36VZBzjlrB5q\n5rHcw/aQ1wA2bk22KBo82eGFtlNnZNvZuMs3axNb9GIrDGDUO80pYGgM1WuU\nzuZtEBOzMlMCW5kLG30N+RVsi2dyWVRic1xeiheZLM+3iPM1r69zcL7fG9Dc\nbLJEa/cPE+fyq5gDocICX/fcUwLYC+4Fnb9tGkhuVPEAyS+4Prdvh/8XEarH\n0hOb/4ArqccAI4Y0Tu8bWpQX0LCgI84dQVN3njaQUVhn52hkjsBCwaYOv0Zs\nNj7omJokXEirLqQ0pDanr1wC6yYabEaFzaukA+typOSAtao7OkLg3hFBiUPM\nHGnqiB2VnK/Rhz3wpstHPCuoUu8LMttaNI8rSwPdA+hFce79Hjz7lSyMfe/n\ndiZn940WJCAGjXblyRf3rd19hiD14kamVR7EMQrRDWMfiY4WYHyp/fC6+scH\ndVbLdJhMpx7mUXcDDivSSIpl8a9WmjyPDgYzh0xAvJHXiZbZP8RiOoimLOM1\nc/tFBjzuDyg1i0xjDH6tHtzXV2ix/a1dDUcagC/T3PD3P3F+yOgaRlSsH06N\nqK8RaCiBFtXcmmxzZBkjH0ChIzc3ljVZaFXlP7Fzq85DcDFFW8QWkwRHLqxX\nsQuf\r\n=BnMk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCgAnU5nsYBmhOzHC32gse4MHHmCW5CFTW1im067tfVVwIgSwnTXQ0zs7P3VlYwA/RBL1hMm5c5n8mgSFvSs1rc07c="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.22_1620114320988_0.7572113826967093"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.24":{"name":"ipfs-message-port-client","version":"0.5.5-rc.24","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.27+a297e8e4","ipfs-message-port-protocol":"^0.6.2-rc.27+a297e8e4","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.27+a297e8e4","ipfs-core":"^0.5.5-rc.24+a297e8e4","ipfs-message-port-server":"^0.6.4-rc.24+a297e8e4","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"a297e8e4770f0b8e88e065a604acd5928e561419","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.24","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-Lq1NVQbE2PRS0ZWjF7B4VHIu1ZlmECwN7KaL5Blv490Q8LAkiMEzGGMHXwWQt5HUBwzMH7TI+tcfuVTIeMseSQ==","shasum":"9a3836b53e728ddd866ea79c632f6efc4c14785f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.24.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkSiHCRA9TVsSAnZWagAA67sQAI8yqL5QWpoCzhAkTJ/k\nMIMi/eY95SUxa8mmX+0JooQd6OD3SpQi1gGZl1jZesw9rkZ2ro6l04Ral99m\nijJ9qTqdMNg3kOWbgM8VIi7rnETOT7GGVDOGJpw6+57rfksp1GcRqC82DyEM\nJDwpTPhh4ZGI/V+Uq8aZG2UkjNEYnq9EW2DEefxiyCUUqIhjT6ymMNL514Bc\nwnBviC9zkTAgpyw9jbJyDmfwuPr26IQqIR0Gmw1AM2aWW6sOMeNpmASw31bw\nA2w/fLEbhKaHJKgMnIrHvxx8EyHoetMXHY3RxI7jae9IhwC2nUDZ5j4TMd5L\niRTgCubs5b8ztAv1qHWgwF1YocgK9v4jKT5uxg7dLGO8X9H7uKfonD5VPuYL\nWd7+M4hYx0s9loaEhTjjNFoCE+HYc8RE2eDravlh+2ERUiAs0ub6wSU0rrTf\nzerrTuFcFb5nb61R6cWWGVd67gLfasjtHvFaF1QuwHvKAEGmjLLOG0vMDmMO\ne2GlRa7zbfhgRWhuwBTLeKouOvX8rjLwcDt9ezyXjv+iebbNsLGOT4cNK36y\n/rsLF+P7zj4fHyEq4rCTLn1Xf2pjmbQA97zwGNGL0bctoxaERPAOloPz4AP2\noamLv9L4A7+ozx+vcTSJBfqmlQO5pLrpqTODljJWiJo2NQolyItNJQ7DQNS8\nU4Sc\r\n=68tc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCTncuw97uXRmuU6fdYCb+mHFshtWO52l8VwQ0Snt69OQIgbtqywONSQ7ou1nSS92XNEIcvAFe3zu+f0W21TN/x0nE="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.24_1620125830953_0.6677829002213111"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.25":{"name":"ipfs-message-port-client","version":"0.5.5-rc.25","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.28+09a65ff2","ipfs-message-port-protocol":"^0.6.2-rc.28+09a65ff2","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.28+09a65ff2","ipfs-core":"^0.5.5-rc.25+09a65ff2","ipfs-message-port-server":"^0.6.4-rc.25+09a65ff2","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"09a65ff238770978bc9a91449c9d76896f9db8ce","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.25","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-FruWfMn0MZfRYcH5zE5LcgpXwftcrJJzrTRCwKP4LWc4iZBjS7TcH990nG6aj05xnRrxNBXHp+CmGRWgo6/WsA==","shasum":"a1f0c4221bc80a5e4d1f783b402d4c8f6b55be77","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.25.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkS3BCRA9TVsSAnZWagAAfLgP/1Tnyfm5OOPAjs0Ov4Mj\nwozEcdnOixfhfQqIiAcP4vigUEDYKLsQibd3WWrM/ycqY9m9NwgcfXE2qfOR\nax/uC+TLAhb3FERLEm2Hoop6Fn5yehWDvPulEHFwDenOqEGnvUekmNijUZwl\nY4y7srfnGxgKA+/xNeB9U1QslvZQ4pGoztH9dfcBMO8D+jSaymzga+JU7VQS\nB3YBWBzNBxo2g4L/YTNq2fKkv8VXhpjp3rn1/CCFMNjxMU48Lm0heu+MvdoV\nCsA61iAHV1F0jw1zYrVojcYkBs8YFH82O5ZnB6A8TiH7Fm9j3XL+yVItiwj8\nz6G/qzjUjze2moU7/nsBZ7h7duEYzoTY13HW47MFgCYW9lvxnrdll7TUA+Rl\nAN9KFxcQGlxocllR2ebb35hwmPs8QlGYCIk302vBmcYPERybiw0sOz7uzxT7\nz4WsxK83MphJACW+REfih5VRpOCffnyceBiSzGucYIHNS6PyTrg/YyQLe8ds\nrCYfpX5+P1KbM9aYXMppNcN851m34u34SGAQZsTvtA/HzYYWXgxOc3GcKvh/\nUNATn2DMwNHTfFlxsJvD5xGQn0SKZ3DlPg7t6Y/2bAhP2/geLEfsGeyOo7kt\nIjXfSUy3fbz4eGeAVC99G1yfF8UPz8DTczhVb9FX+f8WJsQEmTLG7PuW2+0/\nGs3v\r\n=mfjD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCe4gZOS3keYqqE6/lvdPr0+VvHliBgnTO7fkmcJBH69AIhAMot4PoYyS/+AS7+rgSjCzoS5hIaLaEqXihCla6zNwEI"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.25_1620127168649_0.5491604254421871"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.26":{"name":"ipfs-message-port-client","version":"0.5.5-rc.26","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.29+1173edeb","ipfs-message-port-protocol":"^0.6.2-rc.29+1173edeb","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.29+1173edeb","ipfs-core":"^0.5.5-rc.26+1173edeb","ipfs-message-port-server":"^0.6.4-rc.26+1173edeb","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"1173edeb04e6497a8e4d2336c83fa8c450fc9a24","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.26","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-fqwh5V06vYx771eDyZFxzvZ0cavz4r3tE+4rkxWz/PHa9o8HCsfxSqcXvklIIGSpdA7uix/97fr9jDWj4YtvhA==","shasum":"4fb7032ddc44eb47fa24a4fb09181a1b74ca3479","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.26.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgkVJzCRA9TVsSAnZWagAA/QAP/RzpHH+TlS10U961b/4w\nIxUSNF4s+QA/xo8b4jku9bqJmZ8n7xVK8Y3j8ucajkrCFegXK2qhEbaBxaZz\nIhM1MgWRFcNKgr7hznIAPVH8Fx9MTJsyk2Bz9pkXtS1gelk6t6eZV+BCjZoB\nBIUTnoxJtS2pN+5kKpEQOn2jfXXPAPc9rkKzSeIK0gx5x9WuEpWZeRlA3ySc\ngcYyI5OHxNvrhoJX3QrVpl5RgsJEI7l5aGIjH+L1C9h3vSYCRLKhruGePcsn\n3kIhHQdirW7KBlEGvow33ZrgVhfP2ES5FoIwfmL7oWTejDWQEaZJOr8odIDh\nDYhuze6lkB90QJmtXgbMhCYExsiasUUQZxvvQ+Y9xKWSUkRgtvMXPOVjokbs\nW5x6VR7Pof1ClXy4/cM+INGYn+ZqP1KgpMZnzn+2GxwVYnIwX3ps8/6RZvYp\n4L65k+z/eR/kQmNdp1s0x4qS8SJBwJvL9nyBqs2d7aXLpSoAHkrYmvOKkxB8\nNFaBJX2wokB7GtxB2iHa/Satyo1fQQkAr4Qp7rsLfr05EVF8Fb2Z+iCmAU63\ndKb3EmfQNOcnQBqndugYcZmQublpYcMmiRJvHfYeTqJOdXGXMMhGVqx7LnpF\nXrt3Q5qGv4jvcoDApTq3qNifzGwhpGRgguexAlJjks/olFeR9n5vFycfVjJe\n/2IY\r\n=gZr4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEkJ0lcIk1W0CeL/K/+gJBY5IY/BLxMGKuZ6kuPvpa/vAiEAp3lNV3SSSm3PiXwujW9EQT3o95oz+Zo89P0dsfSl1IE="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.26_1620136562544_0.9838504022691841"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.27":{"name":"ipfs-message-port-client","version":"0.5.5-rc.27","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.30+3ff26938","ipfs-message-port-protocol":"^0.6.2-rc.30+3ff26938","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.30+3ff26938","ipfs-core":"^0.5.5-rc.27+3ff26938","ipfs-message-port-server":"^0.6.4-rc.27+3ff26938","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"3ff269385bcf0432e94aed545f74ab370d664557","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.27","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-SDscHDT1LM3PHGQPsgUkP4CANCFuaLNc6yEDl8X+yuc9MwdMUQDMA1aSjeFRlhDsJa0DFf2kMhuiAz8c7Lm5NQ==","shasum":"df11b29303077536e87cba5e9a8203eff8507572","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.27.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgk9ZSCRA9TVsSAnZWagAAf+8P/20StM2t4Rsj9r94OhUJ\nyhxW7istzfKGT/1tWr3CVFuwLzI8/5OpINpIKSbavcNSIn/mWRZ0yjMs4tUY\nm0JQ4icPfJZLa1CyiWc3NrIBpBVIG67g9vzT/rXeaAim4AG2eVx8e9y7SPqs\naJ4yNCXVIMzx4JaqMcLO9p/yCN7EDg25jKMp1Spk9Gf4eWhzD0d+hUSBgDZO\nSNQIwKC55bdqV4SfKDrA/Srolk/OBNXtT0riONdLU5mYA5VeLCLIqmySlmNP\nqNBBCzDlLqrVKCNBaHMWdQH9s/vCuwcVb0uXBiLKOVB+EdQlWQtKZ+DRVX0U\nxCj+ECvQ9OMbDvGagrPV23SBaEcjmJtk/eDkYgzwAI8zmKZ8mlfLqLH7cNlz\nnmdiLRz2wDTRpHpwJvyqxxxIdnOPiDSeHIPtAgaymhUqYRs4RtKEXvAMiYW5\nACbq+NAw5eNIWsiDVLSD6AoPuIbwNyuzmncDZe/gWeQI6kPHp8kV123j/nhq\nSkuap3q34wpT0cUMOS3G3uiFKDuoYmjOsjieroaVZiHytDp/gyc21M5I/mgb\nKYoyKKGG54cX4wpJ/c9KxqjWh+EPaoHYgBeBpzTHmImSZuyeS+jNW2Go01mr\nsLnxJBilA5QJyKNtNZBxc/wNnA52dOtUgdzfnt51KLDA/UIDTRWRJMq6Bv8z\nyIrJ\r\n=26+f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHdBCmmrCEewkYZZZ8TW7NvlFmtUCHZOngb9Pa+ibEpXAiEAkK/9nBltaogDA57UlssqIAI6/6MhNPJdKnGgoFoc4eo="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.27_1620301394166_0.004467374895746223"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.28":{"name":"ipfs-message-port-client","version":"0.5.5-rc.28","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.31+d5897854","ipfs-message-port-protocol":"^0.6.2-rc.31+d5897854","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.31+d5897854","ipfs-core":"^0.5.5-rc.28+d5897854","ipfs-message-port-server":"^0.6.4-rc.28+d5897854","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"d5897854419e83a146dc8cc01de04e73b250d07f","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.28","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-VAlYz0FgKDvHQDhAzgff88fRNDK07ZtHhv8YQgeCUabcsDoOrDf6Jh1CNGGicI5vyux78CiKD73WISFDKBxqGw==","shasum":"42b2573c2520b1acdf5d88135544ee16f363fa2c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.28.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgk/qXCRA9TVsSAnZWagAAgR0P/RpD+ELxc6ubXagebAST\nRhDu9mkCaHu9ruP77yNOPjMwpkIE5aDVDAjcJ2eqi7cUhMTUteveE0dsjsS1\nJAHMWAiKK2vPtVe4o2vTWc1UIM/xomYuGYDz1yhGZAycJrW9j6iQpzhChDOp\nzaINJ9LEojtg4PTmt7VGrSPjrjEH9m0KmTwVpDkeZGzh+J6jkACWRv//KY5m\nGb/0/3Ym+Vrus64Ahx35zUSED8wF2O29z/Rh41GZsjZv/3x1HintRvXoqSBw\nUeCZFf0ZpaUZvICZifpEcwJW706p2y2RkOE0Vpg2gKvZkXboH/qsJt3V32e2\nZ4jiMwX2M5RII9dk0M3RpeFRSUqjb+87oJ+FR9kP7AY1Ol9p8m9o3puYrA+w\nmyXP4ccy4kfxgB3MQKx3x0r1Ifi10zE85lKzdzGezSKAn9wKYxVQcb6cvA6p\nWCVh2rZQNsLSuK6cP6XL0gWpqs21/1gCqiY3qtJulVxPgObApQF3mnphyABl\ng3pv7zhgGi1pt0VgSjyph1UWwt4EgPcwLVMYzQrN8LFse2S1CC+R6Ny95wzy\n0Q73n9yv4eIA6KVPF2+D2DNZbkcsAQmV6q2Tzx9a48Qf3d37RLS+gvEmAvEN\nOdAMA8ssaKNs62GkmkEnDGv7aX1inu4NiE82OBFmqcxOtqq/dYFyU5MgYy/R\nFoHo\r\n=Vppq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB9Ljd2ibGFU0/uXmDNUfPzx2QjS8C4Lke93X5N/2pVAAiBfwtEgr+uAxPvJu7sW9/iemPlxwFKlPSKwaroF8sS9RQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.28_1620310679284_0.5314130716999956"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.29":{"name":"ipfs-message-port-client","version":"0.5.5-rc.29","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.32+3923133d","ipfs-message-port-protocol":"^0.6.2-rc.32+3923133d","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.32+3923133d","ipfs-core":"^0.5.5-rc.29+3923133d","ipfs-message-port-server":"^0.6.4-rc.29+3923133d","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"3923133de800ffd5a5550da86b7bca254206104e","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.29","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-RlP6dYO6VkLuLhyrbirTUnnsyle6H6qVBBbR4yxnUzDz6KqpRzQbC3QnEEFO3Jn1aw1fuKgNCY0BnOImqP837Q==","shasum":"1bc442e7c9bf0841790d11ec0e5373c35df0fa94","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.29.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglSufCRA9TVsSAnZWagAAazYP/3fGgTLJCGAoR+acnnvz\nRYZf9ccHm70Lxd5bafZLDOy7EulL1nCd51fSNxrcv5CE7g/h3ynr6924ZWzy\na4hIXbWAT4oGg9HZQau/CO5YXxIbqltsLbqxiUXkmY5iZcq9F/Edqo6qh1a4\n3//c3LVCUJSGAuvS6L/kpP4ZguArGmCtJiqTWWiXsmtXruu6P2B/P6xv4vMm\n5l9goX/Jvas2qotxG7zwYEgNFzXynOVEaWVy6JwJPegjyoaf3KvtEAZ/TRg9\nshBIb8960eTYyJcNEpEaR2xno46h/m/0bK92K1+W7eJXkpO67KHyDt3wPZBu\nMiQnAgEPB57PQ0sVkfj5Ss2v3cZ9N1hmRODbZy8DJWSA62IAWC3g3QJzlPFP\nVIE+x4W8gr5VGLMu4thr9Diu255MVazF2788JIeikGQleNfczeX3FZYdALIU\nOYZPM3rzNDQTUsv8Owwq9PVXKZn1bZcoJlO9lcHVVfnRA4icfXDgHgeX6r74\nJ6CZvm/lA1wRtDpn397Ghqj03xm3vG75rkdVF/agbhP24b/UrI9a45CERFhi\nPCiXAjEtpXCNTjzFHpk2d2mr/3Qh0qKpDY9BQXi568bF6eBlk6xwIfojVMzR\nKoNZbcHG94+zr9PSALtF6DFO9volOK5j6ut0YUYBYwPxLD7AmjZcacJdWp0f\nQSC2\r\n=jcXT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIA7h+TjMPC4P5POxJ/y/hnCh3SGqG1vye4lcexy1RB8qAiEArmlVQTLXADqA3MB4LXk8h1wmL6jQg+SYC92Y85C5mjE="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.29_1620388767417_0.055126966193917104"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.30":{"name":"ipfs-message-port-client","version":"0.5.5-rc.30","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.33+cf78a190","ipfs-message-port-protocol":"^0.6.2-rc.33+cf78a190","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.33+cf78a190","ipfs-core":"^0.5.5-rc.30+cf78a190","ipfs-message-port-server":"^0.6.4-rc.30+cf78a190","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"cf78a1900dca2d466b3694dcf677eabba5ea3b17","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.30","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-RLIX2cNtcTTVZKqG/bf5HPyY73EqB17Wrt5wg00TzWIhl9BT7TbCdReEG9JQQQXkhA8PpkkTudAOoXhJEaaiRA==","shasum":"52c8a8ffde6490dcd9e560a3d2ffefe8af95972e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.30.tgz","fileCount":36,"unpackedSize":176507,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglUMwCRA9TVsSAnZWagAALjcP+wQaN7Inia3oZyouYJZ3\nUV7d5IqS1/FLUbkzZoyH8qaczqz7qlzXRRnXWmpyp6gCjvsz9GvZ2wt7t5wk\ncBTvZyuV+O/2p28X4CuxEOinngfXhNA87PWQT4PCrYr65nI1wB6xDUPULtne\nJL42MXAtG9RWkSxvFeJw9BkFABo/UCQTMxwQotLF/BLD2Q6T3fK+pTeBaCiM\nrBFG786YNC4PxzwqlB2akt2URPn+6tz9/n6gFj4T6qDqVr6GoCg0Yfj5qkEr\n4Na6QjA3e6s7DL2EE57fsWuUUbK7sWnRrbCGigO1gTdqUWBN5Cn56Af5ej6P\nM9I3IQ12p+/6EI1asXBQo9dKKg02JQgqwXSDKSy9icbwE35LMyKgnjq5hstF\nhS4XdJBlQsXjW5seasKUEqc37t0dk1gjCsjEcDtam3oR6gWbjvW6Kxfi+tbo\nqrL/tHiHScnZCvo+odaXj+BxB4I/o6LuJ8pgvvT0hYsQbxZe02A6LL+RgoWI\nuo6xJUpJB03tkqYey5KSOjizPo89lYoCCqgXxnko9he5O0zX3bFH0xs+Wy2n\ngANkU10iidNfMCYykp/gxybVUynousr+mwdsg1pYpbjzOtlguIVEqpngVOMt\nIyAj4EGttIGNpcdLYuJaulwTkaiaUHjp2THVPNyEbBcxt1k630+MNMbrajJI\nboC4\r\n=NXWH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC1jZYPtEzI0abN+RY7yrdzmiENRfOvhWSPi0DJfo8LlAiEAgYJocwckSLVpPfCPw2yevPFRozMww8B9UkyRW5JiyHw="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.30_1620394799681_0.25094080723105483"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5":{"name":"ipfs-message-port-client","version":"0.5.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","typesVersions":{"*":{"*":["dist/*","dist/*/index"]}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"prepare":"npm run build","build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.3.1","ipfs-message-port-protocol":"^0.6.1"},"devDependencies":{"aegir":"^31.0.0","interface-ipfs-core":"^0.144.2","ipfs":"^0.54.5","ipfs-core":"^0.5.4","ipfs-message-port-server":"^0.6.3","rimraf":"^3.0.2"},"engines":{"node":">=10.3.0","npm":">=3.0.0"},"gitHead":"f7e44c203c2aba94548cfd32c58e5510fd3d5557","_id":"ipfs-message-port-client@0.5.5","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-LJd1gcvDMbrIUItWBdKh7TEAUf6I2nNFJT+QHUYUBdT00E4wmKw7uFLa68vJna4s4kNvPKcRfUxyixbWpm2d+g==","shasum":"c00ec5cb845a41ac005b6504acdfc5095fb330e3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5.tgz","fileCount":37,"unpackedSize":169724,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJglWChCRA9TVsSAnZWagAAMuIQAJP16SKp0JahLe0tQG8T\n0qdjR8BsM+YwXa/1aiDpSfuz/oJ6gc+DIMp4+SAJbHozt7R6xz/to+m0yzC4\neqgspFncC+8dtDJxyHGQAx9iAxZd3JQGW/qMAv6tNXCBU77tv78tI+3ksgVj\nXAhTSVlWAI4BKalKMgqQJdYSy9p46BSuUBvmYrQoplFqvupqHYGMBbG2eRhh\nwqn/wfFI+XdXs+W7ycTbMg8wAPVZregH29oE0B0WFmCbWuBwFV3ksZ50pgep\n1zNuajtLzCSpyX30fV2xl8pUasDHfYgkk+mDyBaUFRR+o6qfO6DBb2ttk45A\nOYgL6ZDyJANfSgkXFHxIXTNvbNOtuR3bwVNNpPWqUMi0rkebvEw/T1CApteY\nuBccBF0rQ1f3sOx9gZWOZdu1YAf4qSAE//QkcPCVAgVMOcx6MtbIfNtvrCBp\n2bTpt1lLNT+O/yBYLDIRWaonnrClNct3iYfNUEfCKAZV1jJfBlFq5Y6sHNUa\nt10vuxygDgOaMACuCUCOv6yHLM8jn2L9GXOv0OhV4O3vzEwDE1S7UZiHdLfq\nw4POpxtgP2zRGnowsj/RGlqph36klu1aYeN5Zc0D1/vwIPdPp0pPFikkW46T\nSQtQF6D7VICqXaDSPHs6oxBIDO5Iji2tFVi8BK8F0aRMXIbWeBITGJxoaDxs\nhCw3\r\n=Y2DV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDQbYTpJI6TWMxVT/qRnwlOsIBk9NMk4J3EmTnyGdTz9AiEA/b6Jm3wWbJ8gXoa7CkUVATxN4+HjvAxB7SGUTwW+IKA="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5_1620402336842_0.9857669341666317"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.31":{"name":"ipfs-message-port-client","version":"0.5.5-rc.31","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.34+fe6024ce","ipfs-message-port-protocol":"^0.6.2-rc.34+fe6024ce","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.34+fe6024ce","ipfs-core":"^0.5.5-rc.31+fe6024ce","ipfs-message-port-server":"^0.6.4-rc.31+fe6024ce","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"fe6024ce70fe83da84bfd938d725f3e6814d0e9d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.31","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-X+sEGgwoNqBIPRWeitpOHLOoWFTC3AhxDFNr1LukSkfItYNp22+YIVlcVL+p/iJ/eTfIPsyUk4nDeXJL2+hhng==","shasum":"9728c56b0ab11518ed0597f1be573f640345cb7d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.31.tgz","fileCount":36,"unpackedSize":176713,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmR/GCRA9TVsSAnZWagAA2mAP/0nv6xeDC88H9lgYFkIr\nRitTLyaSzjAxc8uWQVt5LeKmxN252VsTO5XRvuUMmXJMdjRGpXJZptKS4u85\nfRGJCDq9rF7NRKJAIKWMy09AePQXPGnSr1okDuJYpz/koNy+FxS3v7tpfRKO\nJztkgs8iVPNC6u+7AP4UO5ijirW451+ey0tNX5jgQ7jjwvNdiC5TwuNi/qeN\nLObvYd8ae5PzQ2Sd98xM+mbg1DEXVi7TlHoH+Vi5krWfqjSAVdSEVZhyQNAU\nIvqsCCVfzjqJBzNJiJkQSQHnIZEbFSgDGt6xNxsI2ilvdpbDdAtfftNwVvSg\nZYAWhgMASzU3yNp+V0rP5+FhzgdSA4iCa1YwODWqg6S34tKnRihiS7wUs3Di\nlRHVjXufj8vNwz76YBepWC+G9Jp58t1RedLj2dipKRXz5P9ekkB07QVVgBdt\nP4edjKnlNjFe5gURRnnYUaAHUAaf7gmhjT7Gok/abhnMUzJR1ZmKT0pN0F5o\nG6Toj6frq76uzbFRUsMNmT8doNPvwjOZ0W9Lj2xMMMsL3ROvmzKOlS8T1fmz\nbFsCIGXAIE6mvKu61/15GvyQH8T7347rDSktv1beOhXBa3ZnPeJF3wZNi7hV\nqnbKw7Hp+nXFvq05bFmOpEsqvj9/Q00V6YLUu8vyPSPKbwyodoCGYVfAMmaf\nx3Cm\r\n=X4sH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEgxzznVlhgHzLyox+DR2gXuAbPbWrary61dSqU0UfQbAiBx1N3IgzGevfNy4782mZrpfG8k2EWT75vEBfkHAjcW7Q=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.31_1620647877986_0.12566441042595078"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.5.5-rc.32":{"name":"ipfs-message-port-client","version":"0.5.5-rc.32","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.3.2-rc.35+bda04d10","ipfs-message-port-protocol":"^0.6.2-rc.35+bda04d10","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.144.3-rc.35+bda04d10","ipfs-core":"^0.5.5-rc.32+bda04d10","ipfs-message-port-server":"^0.6.4-rc.32+bda04d10","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"bda04d105587606ab2d7efba04b232bc89b1edc3","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.5.5-rc.32","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-u/Df9kAEOYOhMo8f3AYmyUAFjeieM1znKbVwKt2V5nqxi/uIWBox6pY44GM5szQxyicJQfP+QFiGVEdA3qhbSg==","shasum":"1dcf44e95f1402bc3fd635c0be0456935e7dc458","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.5.5-rc.32.tgz","fileCount":36,"unpackedSize":176713,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmSVACRA9TVsSAnZWagAAfZsP/3sLv33v5pQ5UgJ/0wfJ\n3Z5WITeMSmyav97N1BklK0By8lOgEl5yuX9wwsJVOuxUiDknLWm/+ptQSjXd\n8CXkGqQZogygTogsAPPtTgyTOC+wUM0sLzdfhGHLYKNa02ZSQcbp/xsMd9Sp\nMNgz9giEiw77ko4k84Pga9puRzNRyd+HuRfNk7pkOASsLYekFkCM3TITRK2D\nn4nJDfetPcDxOHfZtxPheJltw8BrO1TvvpZiVPsgNfEbh0RhrR+vUxMKqo0I\nsDRZU41+r/lQvNrNzHXuWtNu16c+2STpRD7UnTwWXqjXBNb+mfNTeXx7Ja+M\n7j+xKf+V75FbaiQbOrEAldHcqWue/JJuROnlRsDN8BYB5qaFA3aOuDf8w4h0\n0+6oGUchcbvGmTmzJInWFtmwG1Pz0EaCR0G/eIYVE72ASux0E+PBiz5ecIb7\nyVH8OcqXsaaAgMm+Z3s9piKMa3uk/IoIEpUWKhR4MCf4IbY035GsALF4Ko51\nnvr3cgZNlq/7mpITI71p3nQ6HsDo/rWu2YhB2cvHqZYgjq/k8HP+owYRfSjI\nhbj0KEPE2PA7CdOI1BQYbqKKN4VC+npluvkNRHcP9VROac9als4NPemKz2hV\nbMDmuIZ34hvFjB4q7kfP0xX41EgLqct02VKTgCLrzWq9AaGO27I9OuUYy+wG\nHQhn\r\n=rIox\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFXwLYzsQ0Ex0QF5vAFEqr4xX3ejyeTKxnP4WPtohn/cAiBaXOU1B8+ylnxJFflxh0u9EyeDorm16RxaXYtQcrrHjQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.5.5-rc.32_1620649280453_0.949778744489822"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.0":{"name":"ipfs-message-port-client","version":"0.6.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.0","ipfs-message-port-protocol":"^0.7.0","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.0","ipfs-core":"^0.6.0","ipfs-message-port-server":"^0.7.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"99053f721305d1905f36a16631f036e883cb02d0","_id":"ipfs-message-port-client@0.6.0","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-czcB662uzgiE4+bOXq1dlb0OJqA848RtTEsDgkeeUf2Z0TPIkVCLwBhFH635EZoqCyNjGZJYanTcYq42EkPStw==","shasum":"27ede038de692f823c241cdd454003d147497ea4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.0.tgz","fileCount":36,"unpackedSize":177358,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmUjVCRA9TVsSAnZWagAA8x4QAJsHJuVEqGaMTW2IHkxp\nUFpAYi+bimC/Xbhae+Azf0+I7mehEnsVHR2RLuMC9DfHrDRej4jnCNZfYIWE\n1Am+eRzskUNmwep7EdwHln8oVepTlDGLdO1j145V1tkixpMPropqu0CfuC1g\n0Ncz3OIoKW68WLeCiTUukUCLzDy3b2GvqAFzCeuWA9o/4fofD4k3VPBh63Tu\nMIPh/aqYhjXHxVTHXVc4gF1GFm2Q2mf9IlYHoObcDJ4BKxh5UhczzO+ivO6c\n0ebp7Om3CDGHA2Nh4uNXcrZhvBzd7LMRwQmBvfgjlXCeohpHoN8hfW+uIKEA\niEs0quw1cn1aRkM8qcHJGnFvlCjV8ptaqjqZtee96FoWUA0SMHz0P6P2Zqyk\nmJCG422W3l/4qR9MTGZyV9hiFo+KVvr3K4EJ/LD9i8z7esAx4yovdFkk6HVc\nXwiUReHw6+RjQlBtY3iyTc6aufuAdXYF/dKij5LpSxoFteXceEeN51fN5Oq5\nAdCW3DSfzm0hSaddfY4XuDm2dRtV7g8x5yy7vBdZodoenuNLZNKHLS/wJoYa\nd+tWpfdnTTqSYaVJSXvtDvwTwGvPt4qghEtncfG9dlzBLSTnanIWvvTL/I77\nHrKEGjHIM2K1fdSEJBOOKmYOT7HZCOi3GlUAAei8zXAzxLYmuzoiu0shRodt\nIwtq\r\n=xH/9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCeNgJJB1SI7OKxkRnZNRWu2aubtlxvOTdwE1smVPtG6AIgWvJwQNnV5Sr2cIn/HLtUuoUztjtC17hLU+P25DP3XTw="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.0_1620658389164_0.3958358046749224"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.1-rc.1":{"name":"ipfs-message-port-client","version":"0.6.1-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.1-rc.1+7f6faa76","ipfs-message-port-protocol":"^0.7.1-rc.1+7f6faa76","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.1-rc.1+7f6faa76","ipfs-core":"^0.6.1-rc.1+7f6faa76","ipfs-message-port-server":"^0.7.1-rc.1+7f6faa76","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7f6faa76a8b1903242f941837e2c717cd8095d10","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.1-rc.1","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-hpNnFNE+ekhqEPqvp7R05x/sTmCylcew9R80kNQxff0UgbHGTnEIAomJ4ztv4IJZyTv+f/AueHQLzqWTYgNydA==","shasum":"f79d6db6b2263c2e47d8a56a4ccac764fa7cfd97","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.1-rc.1.tgz","fileCount":36,"unpackedSize":177428,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmh+1CRA9TVsSAnZWagAAb5MP/1Fy13mnYkJ/nMJGom3A\nicxQqO7W4bv7BnvosjqNYViM4vcNoRnl/LvFL03z3TgJB/ouDRubLnakXfGO\nJ/s8noE2EROG4LGPYQQtXp50RgeDdpdM6MF2eDHqI2NNVHUWAaGyP/6sn/Q3\nm2VGHWuLqhrRAscyRXWa0vvQG58SQhI5LRwlZ2Ji2eJ+GEiEc4Gdaw+bU2eJ\nSduAB1mU4AhM6DVWHqYC2eze2K57J3yl+iu34oGEItV5qH/bXsx08ErXwXhB\n+BdX9EX9Oi0iJfN6Q6LTXuZSKyg/P3uMd8v9Ha4C2Yrf6AjwHP9pn5Eoyqx6\nGLP71EaBj89fcTM90je/XVsUEw7eiDnyJYaT+7D/6GQe9YaxTD/lOkW9clfg\nnw14vd84EbGpG0y3W1kenCObC7BDZecJjQudMp9HeoyeKbwCuoYeVRtN0Zpw\ndNRyXO8U7DBV7Ec4eiombi19BMPcrvGKHEDMtiPBgIwvmUgxTka/VvPm/c3a\nH6UPCEN7Z/EoSexuThpW9Ibfmn8ttuJaN09divfXtPPlkg+PyUpUo8DbGB23\n+PT8Pqx1FGWv4XrIc394WU63oWPxXsAtKw2uHO9MN47U1ztANVEBzAtnDYCQ\n1d0kkzC/7Iv7qD+IfPttyfmwIgPvVlUAEANf4gduH5UfdbJpggy0QMmALrLn\nytZ6\r\n=eiCu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBc5UCij9w878oCBKPeMCjh4dQY9HuH5KzkDIxwYXZsbAiEAsmbYGZqOxDnE6JUxUXaOMsm/3G1Yweyd6devZUZBNUM="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.1-rc.1_1620713396909_0.4372191586687255"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.1":{"name":"ipfs-message-port-client","version":"0.6.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.0","ipfs-message-port-protocol":"^0.7.0","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.1","ipfs-core":"^0.6.1","ipfs-message-port-server":"^0.7.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"bdea5bc95073f568a3b0ff75ec5c26a64dd2bee0","_id":"ipfs-message-port-client@0.6.1","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-K3Rn1m1qZNAGOfTWG8ytp6nRwlWfmZtr1MvAHG/jOgfi2dEZtvXpiUq6u/NnGvSu2wilOCcT0nUY9Gy0e1AafA==","shasum":"3edd53527a0aaee9709797482760c9a78f172420","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.1.tgz","fileCount":36,"unpackedSize":177558,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmstVCRA9TVsSAnZWagAAfYoP/j0y9XEb5EZtT89Nplje\nsonVWbLesoh+3YxWmNG5JIUwWpQbxQpk2OQ3ga/Z6Hf+82CEh1YHaw+xZ8+r\nykFm8BW6gScWjDlwMyuBSVkSLXo7h+IAeD+tQbvdg8o/TbmmG10Mp1snv9aI\nrO19khorxse13PUnYbCbsvsv95WMaqJ+dYsXavGGAdsv0M0jcnDuT4SH/yaU\n19e02SHX4jPxjdL76i0pTZb5E9XDI+x1sIjsZEUUIng6ZctZfCgteTqavF5G\n1mqxIWJqqDXOL6AOLrekLEcxl5WPfoSRTLumYnumjpoNLIDJqjcOI55AsMay\nJkMpcK/TgCD0rySM6R9daNm1bGW7Bb9utra+FAJpqv/pSJGHdua/IReirb/j\njKAn1n4tPtQWNHzDgjzwlSfDPq90LxKs+l3N56Zoas0cUtbyYCB68dqSuJ0Q\ndOkZK5EBAf8VivhiBPTOsq8ord/fy5npf/JrVPJJTGWcr3nKezMfOt+T5rEw\nWsmYWzhABA3UMfn/E+AhrByDFNsj/Od4QeNvpeHQIqBhVUa7pEe4cYF97DxK\nM7PMhKXvivb1A6dkdPx9c4IlRUQ+YcbBWvqFSmr8M3r0JWu/4FCfDSEQis6L\n5R5YjoejPjrTfZwZnjIhFdRBy2V6t7B9OFVMgN4fjNmRkXZyjQ4gd1bFUOlQ\n3Hc2\r\n=PIwt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDB1/GH7K/u6egF/g6cHjA7WD1ykgz40CTvg2zRIlZXQAIhAI97WFPcnlwwSkFe4jYpSd6s3nvodCKlBtsocJqM84yr"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.1_1620757333097_0.7387678439037679"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.2-rc.1":{"name":"ipfs-message-port-client","version":"0.6.2-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.1-rc.5+18faefe8","ipfs-message-port-protocol":"^0.7.1-rc.5+18faefe8","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.2-rc.1+18faefe8","ipfs-core":"^0.6.2-rc.1+18faefe8","ipfs-message-port-server":"^0.7.1-rc.5+18faefe8","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"18faefe8bd4ee1f671919672917b848436247138","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.2-rc.1","_nodeVersion":"14.16.1","_npmVersion":"lerna/3.22.1/node@v14.16.1+x64 (linux)","dist":{"integrity":"sha512-9Rl6+f/IIlfZhp2zv24aN3LOmjJwmO9+IXloXF/n7NXWv7L4gpmBgro20JdvpaKE6a8WspYUnyPpa4BD9mKd0g==","shasum":"532bbabb9136d8c1bfa9f77df1416fa5c28e948d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.2-rc.1.tgz","fileCount":36,"unpackedSize":177628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmui0CRA9TVsSAnZWagAAiesP/jz42deYXfAbj9VAYBoi\ntzvznYis5FEazQQzp0+/waiM8kE/v4Br9Uptz8gibfU77wCGQPRSGNkvZhae\nI6mIGOIrBY9lnXrdNNprxIC7xexo9jDw9MgaNybjtkoH0L5U+A4CkyrBRDK2\n3CFwowO9W98BGlQXl+czOhX2KJbzk7HysChppIeExdjiu1j+FuPWb1NeqGx0\naAnxyaz56h4wsAgjtYUBWcrPDBJrAgH1h73xb4G9f195iDwNfpKm6t7pS10g\nL52CzpjAxa4a1i0PCoecp/BfF4Az57T4g1SVAvAB97yQpokKypPFKg6ySLB1\nXcJ/nf2A4Oc+X6A8dXr+R2kvN55hKb6LITfqcmIW9Iq3Ua4cRs7tb16BA7tm\nfBojzKvH/Zf7CWBvx8fvIFxJCWCLStYrDFIzsEx9VGxGkTUB4s1SnQV+Yru/\nKyUKuk5nL5/pxD5ul5Oh7WUekOsL69Ry1ORWzik/dipT9+H60YC3ui3x92O6\nF3YuxQsCbIcdNsrzEYas7U4jeHblPsczWV4Y+sgARDItWeeU1I9CR4fuyS03\n6NdHDth18fp4tQUfQ4SFXRoQwVrwUgo/aHUiKZvCNGHUXVEjDvV9uVanSQGS\n0DmXZgYKDJShUnjS7NXphA9ncVz7E+mBWputT1rTOgNxZ+l/86Qo1WcYYCpT\na6XP\r\n=3LL+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf4qQLYPNI/3Z09zLKJmgumiSVJYEBPSH4IIx9fY8NHgIgQt6EsrBEyoQPZlK8lExPUHiF0CYnsCYrDg9k/zJIi/Y="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.2-rc.1_1620764851941_0.5211594572065896"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.2-rc.2":{"name":"ipfs-message-port-client","version":"0.6.2-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.1-rc.6+311ff504","ipfs-message-port-protocol":"^0.7.1-rc.6+311ff504","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.2-rc.2+311ff504","ipfs-core":"^0.6.2-rc.2+311ff504","ipfs-message-port-server":"^0.7.1-rc.6+311ff504","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"311ff504a98ca562e738eb3bb60fddbdcb5eebf2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.2-rc.2","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-hJg42pn2fhG8sd2DaN2oiA18fksoSQAbNy/8f5dvNZMZNKWXMtC1fvfHUWtqChIzeaRuJzN+WSkZfqrVR0eP8A==","shasum":"d19d196328c1cd72d68cbcc9f2221526f6f0715c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.2-rc.2.tgz","fileCount":36,"unpackedSize":177628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnWrICRA9TVsSAnZWagAAonYP/iSR4SjbQWaD4DtUm6C9\ni+DA29ZLsh5byDEJ6gYxWo6x5m3zY1RbbaWJsZiQ7kv9cGkAhZBm2WbBjpyg\nQek04U/3RBpUcqiN8a+9TfXx+Y0x5tIGG8au+fV4aG/8Xgf+44G8jpZODEQt\ncLhIbQJZz+O0quclbEIcFx4GXmyWfo9exwebiZNxEpBoVvJGRCg/TYgo1oms\nYmq5mNWTYteZ5TYRTTMms97Y0VASZ8baIGMkBEjPy5/QZ+slvNK7VECbS15h\n5YYvnqwhVgXSCzf+LMum6RXTMkEErSW5mAuXMYZE46Tibh0BRVzFQhkdRFoy\nWVGPRezIAEbQy4vARKFE9BMoFHTJFqiG+keD+VWk66WjyYpUuz+I7muRh7AS\n4METQ6qPLLXGZxn6IDMC6MygZH5vQc1bh/27VIelT52owv0DSEgYmWm8TmmG\no3/4W43uxX9zBw6qEYN5lYDXj1VAcIBQAbigoDfjLL1wWjVceAQkwb2r0fcY\nbIuJ6SJO4GGaChQ3StBcIzUuO2QULYPN6Wj0q3PuBZpI2rxV4C3UoJshZaeL\njpo5lVB31LQnVrrRhN2jP7rZr32DXvcli8ixExiEnJFAc65zsJVtyMD+QcrT\nfRMYt+1sOEshGWoulfL7Gk4kqDLaTdUoHrihbdgMjnSSFnOP/qsSDesBGjvo\nIgVc\r\n=1JkS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHrWflIfqlUtbnF59VB1HfhY/fH3xkuLgFBilPMEJdt0AiBjn+6WvPLMHTrsUFLIu6aX23lS1IXYy0Xir+u7lU6zCA=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.2-rc.2_1620929223712_0.008666601723699818"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.2-rc.3":{"name":"ipfs-message-port-client","version":"0.6.2-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.1-rc.7+1926f990","ipfs-message-port-protocol":"^0.7.1-rc.7+1926f990","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.2-rc.3+1926f990","ipfs-core":"^0.6.2-rc.3+1926f990","ipfs-message-port-server":"^0.7.1-rc.7+1926f990","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"1926f9906bcff5bdc8d417a7212a9db52ace7e3a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.2-rc.3","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-X5420MjfLNkM2DvXCN1q6FG1qZ9EvAzAZpyvbMacuGBn0adIhALLGF3P03X/jjjlFimZLlrk6shrJs2X3zeMsQ==","shasum":"597c4f627ec191cf7900c1d5f7bd8962f1509bdf","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.2-rc.3.tgz","fileCount":36,"unpackedSize":177628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrQxaCRA9TVsSAnZWagAAJfYP/3Clp3MsOK7CM+bfhQBU\nd8eSueSOe1Hg0tFvuGe7PMr89Q2kqxrd8xR0mkmbqezheU8q/y9c704Lc9Ps\nseidEkmOoDtFqWCJSPl9T4PcwqiktJYFknjjXve+P29IAQysUAqiVJMKgtwN\n5Ka2L9qbYhp0iokZvVmBwUuyn7q0y4r9RiC81MJfH4ZaWdKsFZVUqVXV+BzU\n/4L9QUg+jzg2LfmVyKa4qAuzzT98zpxfNq89iL7vM6MGw3AdM1W0hw1xnGbA\noEXT8u/S8W+4L+2SUF4BGPxAEWPZjK0CY5xnhRyM4GvcjsvdPmaaiiG8Xchg\nE73Hl612B5iL1h3qeBt379EbtqyQgUwcHPv6Ojs8Eni9vzG6KZWZZKYFxLFf\nhTWXhXecDjpz4mji7RHQllzi48hVuErU4yfLLTr57IrJY221lP9FlYhz7kX0\nrD+KMD6SgHRd4TTxtWwsaJf1Txpy7MTFGq32tanaoylzt4y67e2SR5wg9dlB\n4+ayAP0i2PQ8fyJn5DR4ne4OJNRJOc8ho5BtGsucFWX2ra/3SljIEaJ2DWhd\nZjsEae0dwSTZY4dKcZPFNT6l86ScWTjdT7aUPWRxn3kOgV8sHjxPs1idjR9/\nG8YCELCSUX8miLw23vAK69fGdXWj7masIYdOp9Mj7qcNWj8wScoMgj+yFGRa\nLSfg\r\n=msHf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICypRwY5SEsNXbfTlrIXq3/pulfqVDhCGl/+6gTtlvW+AiEA2AP8izMz0FDuLtROSaZFggE7Rdc5nUluoXTYKHsaEw4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.2-rc.3_1621953625963_0.8792060102580426"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.2-rc.7":{"name":"ipfs-message-port-client","version":"0.6.2-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.4.1-rc.11+e91a1e52","ipfs-message-port-protocol":"^0.7.1-rc.11+e91a1e52","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.145.2-rc.7+e91a1e52","ipfs-core":"^0.6.2-rc.7+e91a1e52","ipfs-message-port-server":"^0.7.1-rc.11+e91a1e52","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"e91a1e52b86fcc9ce5ca5881e8721863b58d5d9b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.2-rc.7","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-ZsZY3v9jXAfaw807g5/tl61XBQV8h3koregCRpNHKLvi7dMk2VDUAE72vyzRt015iLnPUUJtafhqE2fwLTEHYA==","shasum":"48058bf6f1060d0df527eb2d9be5ae63aea8948a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.2-rc.7.tgz","fileCount":36,"unpackedSize":177631,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrSCPCRA9TVsSAnZWagAA1tYP/1V4HqDQYedq7bKLo+6T\nWmFMEQyChXJrF3+Cb3bI/ibXGjMPnKF0N/eIMq6f3ZMZZ9QuZvn86x2POIv/\n3+V5V23f4jKQIxodPjhmzMCl+wxfczTg16yzfpT87do78wAkN12t4QDWr8aT\nxeT7TnBHXkQgRDzhipoTF0berfpx6/KVC785VmQplt1x0e+B3dR4VSkY0/oy\nfzkOETi0Po1bQpKX89N4/Y4fdbM3tWAw6tHGP3bXX2NRTvlCs9+qd8hinQJS\nHphU26UY276DtgAh9AMGJYfnmb5XZ1n/7Ja4hlryJ2UWCZXJ5tOFT2KgtPSq\nCDAQC4OEv5YTFoMhNOgsYg62qG05ai5HU45XRhquJVinNrVa6b3iK9D4jHJe\n7B/wHMFGNcJYM9S5xgF6m28klHLNe1PyDjx5Wo+Pb42bI6FAp0LyMx5kBhwD\nXA5gsy7e5baibeXkMCFBHYbesg036plMIyNKTAzogmr+IUvMko1JXnGOsGfG\nmEMW3lopR96T1itBPprjClyncQLnZDAIT0gA7vgEyxxgvHgZGTGglqr2nbXY\npx+EEsM9Uxu0YqL2MqNReuGQF43clzKgiXHUjZ71LMq73Ml0doHD3p68RHaO\nvcN9OR4g3sSer4W55aZm5lrhSxEh+HrA0XkHf0xznC+Gnur5G9EyCHlRWwxy\nL/fh\r\n=IDUG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAYGhBct/ImRwCWJuSNYEBiz6C7SZdKHo/8px980XL/gIgJz4FmHbqpia55huRICbIYwMadM1eF3YVkbzOLGCuiy4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.2-rc.7_1621958799478_0.6962165397776279"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.2":{"name":"ipfs-message-port-client","version":"0.6.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.0","ipfs-message-port-protocol":"^0.7.1","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.0","ipfs-core":"^0.7.0","ipfs-message-port-server":"^0.7.1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"c40960358550b920d3291b8030715537a63c63e4","_id":"ipfs-message-port-client@0.6.2","_nodeVersion":"15.11.0","_npmVersion":"lerna/3.22.1/node@v15.11.0+x64 (darwin)","dist":{"integrity":"sha512-ZC+ZYrUQ6GLcDdbDy3rORMUb8Ec7B1T/uJ9T1Q2HPZdOLgsLWPpzFUOnenS3/6PsLJ6KN5pPwQQiLV3zIOqnWg==","shasum":"ec567ce95032c9bbd9397a1392b468a6d9d21c74","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.2.tgz","fileCount":36,"unpackedSize":177767,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrhXRCRA9TVsSAnZWagAAaxQP/iLn0wtDgS5ZiEduTTND\ng7Ekb2L5NZNkIvwZO8lgKOXbY+Rd92hOBHSB8B7uoNhFuwq3EgvqtA/scOZz\nQ+s8HTIQC3IRyfrcK1Cqd70FaPBVAirrtRlgadbe5SHKzXMBHV6e789KaTpr\nkTwO6R2YjAYX7chiSDDbba9NzFkmzrVkS9AVkzPwaPTqXUqtONUV5JtHWRFZ\n6AM/27B4R7kYhZmjt78+F0HLVg8eRhTInVLY+yG2VbchlAn7GuWqvvB0MFWV\nXrSG2bXmrg/klplsqsnPj+iaIHvxNbHGbV6oPGUP1YClIWX1luwl8/bR2Y9l\na9IH6eL99NXjpzZDljwfuf4nEpUTYmgGzyncPSTDSiL1BCrOzcsE53OThXw5\nXeh5xZe5AUtBnhyjLMlFEyOvcB7HC57L+ev29mvIH7+8W8PN93wtgbnbpATC\n9qWNSbCiTo0yVKjE+a3oIZ8OTp/UFrTIpid2ZTz/sYX/c5HSbvssBHosy1u1\nubp4qdUzxp5Eiko7x9V8HhxJP+rMeQpfPf/oiplCLaXjWGPgUJAEM55s881g\nayTZyn0vB4KQ6ZNaL/fdLH20/qUM5xxb94G6nwszUXFwvYYiFHQaPn1ry8ki\nMkW+KzNwfs9SqPe5ZwSovQomA/Cx4BvKlqlNHKX57kWa+iJdwmpaTEkZxVPc\n28h5\r\n=VqbT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBiKsx/A+INsmW7BtEMLd6fXfPi2MGetnqQkKWBr4yveAiEA+Yu3zMIBpKOX/kvFTGbsxH8AxxChx4lYXLFFGpM89wo="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.2_1622021584611_0.6828570913149394"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.3-rc.1":{"name":"ipfs-message-port-client","version":"0.6.3-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.1-rc.1+48c4a952","ipfs-message-port-protocol":"^0.7.2-rc.1+48c4a952","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.1-rc.1+48c4a952","ipfs-core":"^0.7.1-rc.1+48c4a952","ipfs-message-port-server":"^0.7.2-rc.1+48c4a952","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"48c4a9520e4ed668f4eca2fccd67f9849e967286","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.3-rc.1","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-wIxhqEswoWsMK/j+0dFrx1S+Gjms4TMf6nxxTonybc6FCxCa8jvO0IGoWYKuv7v/lCnZyHJ0YAL6kcxHW7LCrA==","shasum":"17a45fb0ee57fd92f52aaa6ffe38af984d09790a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.3-rc.1.tgz","fileCount":36,"unpackedSize":177828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgrj4rCRA9TVsSAnZWagAAIYsP/0ComiRgxZ32nTmj0kyD\n3nQrQWNDqqK5kNFoe7biPFwcy1aaiqOJ/NC9XeR2CqpZOxptmH9DjIr3lGiV\n97/m8O4l4KNY62hv7gTJcUm2gbPHNDmtPJUCVOGuayh1+TC9rGoOwR7ha3mM\nyuYz8UVkHqlQI0iK5cS4uBip3X+7n1qVsLYgAr4zHzRFZifzEhvgv2kdvmem\nkmX2cE47L3VKrPK23Eejejv7XP4xdkOTK41B+z3kL9Le2fqxMzx+hmvNTqTS\nq0566tvJkuxxiJ1TaKvIm8egMrDfmfZf+W0vN776yVsI909PhMLURv0xjM4I\nLCw8l9Iawge3hAdEYk+oLalgJwJm8771/KAuqfxl2lEaORRk34wFNVNXrVDa\nzsqqSmXuBL/JxiyN93anA8zu4RZqDM6yqKevMaZCl2ECySRp2ZTcFmuO54Dk\nlAd44CEAe4OFrHus7vvaDpa87N36rjRA5oypA1U+KlQIqwaXS1SK1Hkrmhtx\nwkHboHXz9tob3y02r2uxLYNFd+joc+KXJZsMbjOPAgQCUJ6PIRXHGl/UkHCz\n95ixrvgMuzdjQJjxywfAMxQRLBMOFHGGAeRjJ8MklsWi1kwUzBhsnTTaqRJw\nZ2UHuofaQzwRntH9t5xkwx7LBOfYmmyIHzKdrWsh+NsNYUmsAKH0ZAejuq1m\nBgMv\r\n=Y9cy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDvsQiZn6YFxp2PyaxdRGT3B74QI8wGOHFf8LglcFLRoAIhAJTqyggge+hezwX7zzAILFH1z3QdkhuTKXaFfpdHfZYF"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.3-rc.1_1622031914996_0.17398572761354902"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.3-rc.3":{"name":"ipfs-message-port-client","version":"0.6.3-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.1-rc.3+ff56373f","ipfs-message-port-protocol":"^0.7.2-rc.3+ff56373f","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.1-rc.3+ff56373f","ipfs-core":"^0.7.1-rc.3+ff56373f","ipfs-message-port-server":"^0.7.2-rc.3+ff56373f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"ff56373f0606ef2c59a61916f02e42ff524f16ac","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.3-rc.3","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-jVha4OzgvnF0S04SLHe4UfSwp6g2TZb++tBKRUrBJdR+GchjC74Ie9kLMxQsicEN7ytcpd3NLyTEAk+fvVfyLg==","shasum":"f267ce227f38ae9e44ec83259b6b18a6bda745ee","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.3-rc.3.tgz","fileCount":36,"unpackedSize":177828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgtpsDCRA9TVsSAnZWagAAIgkP/i9IT7OQn2UtaZyEQQxJ\nFMCw/6yEqTaqWYnCgVmLYLBeMLposPg3QlrJyZDsh3stQEULPlqprj6NHM7Y\nG026uiCf3lYgyZsG5R/M3rK+PBHI9P+t3BUk0dsD9wzEczTbyF7/fgzVNHEo\nD7h4I58/Bo79gZF5WpB6xEC7KVTNzVryY0F8tkNUVge1vxdN0qU29J1B+2Jv\nOjkeqT9D8uYfCPSK16ZIIkHOUUPKTL48GNvQyijCSuyPC4xvTQUfgzZddb+r\nlXwpuM8Inw4hWut2+SpktbdjAJNBGMROU3aPW2uxcT3ZHNIN7hCFEMvxAwMp\nl2a/HWvFpuMgPGzxHwPMuAGF1pdQhaemElC3k5QjYBdqUiIiOckl1Sel51kT\nFu0R/Ac0/uQdkPE3FqC5NjSt8fxq3ZJ2ChY4aCOChiteepaeZSDGOFl9Cl+E\npnFYj0C/FHsa7DbVTcVeF7Mw/srJiH2XUkJv246JYiXzZB7nXU0ZVBGh/oK0\nzAveciJhw1jG581q8l6Jp/Rt2w63UjCY7nPSthlHH2LW7U3F+LxRxBG7oqp7\nbw8LvC6E2lKHsVB5lqQo1X1R3HWozEkvDvEI/dwpfzzyQanMdI/e8NqQ0Wr1\nAhxnrrsf/w0AzDJqsbuyyDZittGILLAko2nnPk8ZXbaKslpr1hLgw76HG1Eb\nasxA\r\n=co53\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiMACbxBk54w3rPM0a59UDRU7pWIMrh9UEDy3HgsyTMQIgcynYosmqxKIQeb8Uc25ElOxKOizswop+zBKZwiv8x4g="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.3-rc.3_1622579970636_0.08732706607766638"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.3-rc.4":{"name":"ipfs-message-port-client","version":"0.6.3-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.1-rc.4+c4a1aea5","ipfs-message-port-protocol":"^0.7.2-rc.4+c4a1aea5","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.1-rc.4+c4a1aea5","ipfs-core":"^0.7.1-rc.4+c4a1aea5","ipfs-message-port-server":"^0.7.2-rc.4+c4a1aea5","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"c4a1aea5addf902506e34d3d9821285ff0423710","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.3-rc.4","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-XE1RttatCNU3nTJKMQASrL8ulRNOA8Q80ARATHUENOiFlxBEAeI6b/BjoqNx6nQAPVf6BgCCtTXMjWibZqUklg==","shasum":"29a134944a7a9f1ce23d51ddc52c466d43c49b4b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.3-rc.4.tgz","fileCount":36,"unpackedSize":177828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguxb+CRA9TVsSAnZWagAA2vEP/3xk7mQS921a8dY7IK1K\nAPdGbxI2Wpx+dIZZylwAuDSDK7+oxQvKrKL3oUXH1UOkE1sXFWSpgeWbw6WE\nfTpP0+rQ+e3sp6wCbavsxjeQBlkL/xf6BARwlxrMHbQ22IVF/YsCaZCX6+Nr\nkZ3OtdJUaFPQUam4lsyQdj6eD8EAxyeZ4o5TtdEPjxABfkq0axiBYBquqFaT\nRd40aCzNMWXE59n60eBk5HQlvISrQQ9e/MQ5xjuI0q2OUqssRjLOKXVJzP8A\ndCgEHK5ReOkM3+ikXg5hjLIWLl/OdTl1QutBfKmO4ch8FXNH8PN0oOgXL2pQ\nhr97Ro+c5vfKGx2t1gA2874IHMyGUc9Dt7lG4Od1wyk4xhjHMep933Jmi3v2\niISNTNCGHsn3pBs4Gc7ghEJWsf3d/4aU8SJbq2h7A8LP8trhazwnqt7zlb3d\n52BPQUEx1rlSl0hZX/0xl5JLZV81X5DLPTxJFnxjMfJyh/oP/n7lZOSymYX1\nLd2Pb4yjuHghxyjh/GyrPNa/nr6j4p1jtNNdmDHvStX+eQ/C/0njX1Z+ZIFJ\njR8yRIExY+w7gbGTx6UrPvofnML7e6XGxlckETCXG0LAnAHnV7uS3ds7iPyU\nBD8/cXdN6TOlB4NNqZfoxEYngg2Tynvd8X423lBgU2g16uX9qu8ZkCa7Dv+5\nvJVx\r\n=Lsjw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEJ6tUgkVdmGToriZDD4/5YolvhoX+oaFdhRzilWDARaAiBeVXvCvJdg7x7qvzlm1Lt0xAom5GcOZK5lECAjlSqDZg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.3-rc.4_1622873854074_0.5831491662368282"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.3":{"name":"ipfs-message-port-client","version":"0.6.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.1","ipfs-message-port-protocol":"^0.7.2","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.1","ipfs-core":"^0.7.1","ipfs-message-port-server":"^0.7.2","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"08be8beb2168f39252affc8e840ff3e185c69a44","_id":"ipfs-message-port-client@0.6.3","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-3WCsYIp9opN7PwJjoFYEPMwnKn5gw9b5uNEOUEiZj2W/HrWUxu2xag9hGm4pnIkRKTYar6OLm/bVnEuRQ+T+wA==","shasum":"813affc70a46c6e952e49949f080a6ed8e063764","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.3.tgz","fileCount":36,"unpackedSize":178799,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJguxqXCRA9TVsSAnZWagAAEHIP/1QlifhYTaEsP02DEAHs\nrLUaEYM+CeSI6Q5fc2Ku+zhqXvcSIEq6WXb8iv25O+ZsB6b1+nugymBmGbC/\nvWMAraCxgZ/Ypr9hvkVYcDOZPFIwlSAJLwc1ik+5+1h3qiiM+MgkoiP7Nz3J\nUN5E/Bvk4cclsKPhO31PXoM37w3cIUNfGHk2jHbmWTfqixHaBkLzmB7T7o5k\nab5JnhNhsXdQXfPvKN6X5I1cr//QCHggTut9hlQ/EQcso8PpQLC+zfKEpd3Q\nAwJbGbZV/HGGuHwGYnW4pyS6WelQ/EmJBKVhUfpjDEZmSUoIBF2p8Hw8x+8V\nHfdrOJJP/6sxr8JOq1auPoIk/aMBfnMIkV1X8ARsbiT5n2eEf5Zaet1r9bBw\nPGp9R/NiCKcsSvw3TT2Osu2pzU6IixDVEuTrdsD4lATCGyMXrpXjdfMxNKXR\nM8sCiddJ82Z+HdhruQc9B/e+sJbj+zK/TvH13CSMCNLz/6HJDWXGayehBkE2\n4wRF14e4uhvziedXW5NENQwaQdehS3M1reC7r03d0p4mteji5gfVt6GQsxNM\n3DEWyh+da9eQoL23+Cu+7u339ijEijLCz1CWa1Q0m+FdmxtrrhEday3LW83W\nhJ2LAiWLtHmGfccrWQscmCQoynrGRoTUVU46n0RBHzpOaozXCeuKgDUcJjQg\narcQ\r\n=/Heu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDo6K61Y7P/4hpvE/Ut12UcK5dZ1hFdg5/cvgQgemLa4gIgVEJIOp31jUcqwJT5AnFb/paeh70KDKwGvR5KmbB1FR4="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.3_1622874775585_0.1999683152751428"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.4-rc.1":{"name":"ipfs-message-port-client","version":"0.6.4-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.2-rc.1+714c3de1","ipfs-message-port-protocol":"^0.7.3-rc.1+714c3de1","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.2-rc.1+714c3de1","ipfs-core":"^0.7.2-rc.1+714c3de1","ipfs-message-port-server":"^0.7.3-rc.1+714c3de1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"714c3de17f4833b8dcb7c0ff51536661a22cd6e9","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.4-rc.1","_nodeVersion":"14.17.0","_npmVersion":"lerna/3.22.1/node@v14.17.0+x64 (linux)","dist":{"integrity":"sha512-yAAH7KxeSkwmrsdOG5mQsE0GqPM66NdDm6SeuDg6U2Nq8MqZdwMbNT8X0hlfTrFAKFUqtGEZwazYxqXdkiW1ig==","shasum":"51cdddbb166794976b059838b8d30d2a4cbadd4b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.4-rc.1.tgz","fileCount":36,"unpackedSize":178028,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgwdrdCRA9TVsSAnZWagAAeSkP/0CzGnB2rV6SHqa5uA5O\nPvs/MW2wSkPmNuSv264RQOo+troWN4ubG9TtsdX49vYorf+LiqMAkaErlQpP\nwU6IEuBtoHeR2Yj9ETTfw5nUMMG+K9Lr7aZ/HgerDixiBZVHFdHlNTKqfjyI\nOoYsiSqGjhJKx8BI0xn2Zc6hxHoeErdHvPJ2rYciKo/HE2TFk1bfLL0ns3RV\nUIB2RjhX8AfvZJQwR7JNYXKW4RuviAmGXwDOj0bStcjRIqXWPW1pI2vqpq/d\nCb+BziblHIp81a++wsrKVYw6I2xOffLQsqwqjCyxQuclb0y4PyS55iwvEPi6\nnd2DwaQjurhYl5xiMu8MHzbWbbyOtFdUISR59/gq1VUpBiia570FIYBsWysA\nc3koPhE5CZr0dzhYmhqrM5IM/TxQxQp7cjKNjC8Jz4v/1RHhlx2vVznQ7+q0\nAk+V9UCM0Z7FkdLXqxcJc3FqlzzQvrnDNDVXGSF7MkS/R2lEvFKi9AyrBK+X\n8gnDG/yujf/Ftn6FzzRRNkw7p4lTClFUiXwvHo/t3hLz2xM9i8yypXpImW6V\nIO2KGiRMbydiOEIUgJ0+k286BpSj0oR812moqBHkrOEXrJG5rIvFpwgBxM5z\nJNiVuI4/ExBxQDSFZG9b+ynObhTT9GJsyU9sjfCsJJkmxqQkeM26+pm2c02P\nfU/D\r\n=yIfa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhxSqLc7kAD3mxgj8fTtJX7ymbxsHR3r7lGv3/tVj9HAIhAIRCqkVctEqpBv9mUdeIJ63Wg5GPfwXnyD7VStGTxo2u"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.4-rc.1_1623317213592_0.6036612980250866"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.4-rc.2":{"name":"ipfs-message-port-client","version":"0.6.4-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.2-rc.2+bf44a037","ipfs-message-port-protocol":"^0.7.3-rc.2+bf44a037","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.2-rc.2+bf44a037","ipfs-core":"^0.7.2-rc.2+bf44a037","ipfs-message-port-server":"^0.7.3-rc.2+bf44a037","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"bf44a0371a53325a8ed10c93ffd3514b995185d4","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.4-rc.2","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.22.1/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-1L1PldBW/Ov0apEshKuuYd/0+d6wq55g8Cokr0Ba/ODbjtp4D7KNiUIkNASzyBJcmgIXdmGLpVG9n9fb5CCZMg==","shasum":"c15fb085e4a6e230694e061af21ea4d645dfc2fc","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.4-rc.2.tgz","fileCount":36,"unpackedSize":178047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgyNoOCRA9TVsSAnZWagAAp4sQAJQ4/tXfDJ7/MsfAGbL4\npsm/AJFaFSNktZCKU9oENQLipqEvGo8nFjN0WWKs0pFJfe4IK6LumTTVePT0\nIqsQyzMOKqNzzAJTvGI4XLakK43kdYd+jg2C77TTDw7LXOjaUQpTJDWhPboE\n1kYWfd0gxIyaP1cyXgqCPpY8/LBBx3pn6ep29tIv0A/VR+rQzWDugi+JXqjS\nirPiBF/gF9Gep0SQgDJI9HCp/qqykWWQesSXHDRDIdz+zcNH9axMpxMUeRlR\nOuODqCN3w1dNwxVamip6Qny+tLU4YhBJhu978W5IkGEUjYETIrzwb9FDRmYo\nBII/Rl/0W8XVSNbAdMr69w8CzxxDAgXafFawFLPxYrlAw2gUcWRAIQ8yPmj7\nTodbsaTZInAuBj40p8eVsILGDnc2SMCqQo8qO+sK/00ZCGvvbfCUX9Y2c3Jg\naQDgaKZBIUbiDcZC48fTssJg8Z6H/1I3vEE3uon7eS41zTEuYF6W6UChj4ol\n0x6N2YC+Cxv6A5JMZJIikdDkQyZmjo0qOd86Gb768AxeDww+ktsh7emZEcnM\nHBAnFa7Edb+Vhs36KlXOWkXIC98P8pNgC2kcntAaB1DfA1CDGR1iKoL1vjw3\n6bR7TvLhRrfYgLx6d/6vkKZey5YtEudRC8tTKbADL/r/Tedy44+TwdukTep/\nUSBv\r\n=M36J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFZiMVA9IWqRF7JSK2cyN4YWuQXzHbs+zPM7jw0RHeE5AiBoz2cRwFh3VkZeS+D9u8vidxBVcSxUy52FYLy93x2Xiw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.4-rc.2_1623775758863_0.18941625400891704"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.4-rc.3":{"name":"ipfs-message-port-client","version":"0.6.4-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.2-rc.3+b1bbf5f0","ipfs-message-port-protocol":"^0.7.3-rc.3+b1bbf5f0","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.2-rc.3+b1bbf5f0","ipfs-core":"^0.7.2-rc.3+b1bbf5f0","ipfs-message-port-server":"^0.7.3-rc.3+b1bbf5f0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b1bbf5f004fde7a26f8cbf6e0bd7356f07dddc94","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.4-rc.3","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.22.1/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-+LgMy3lxiCvZ7fw/PoID8tuUxBY+SFalmq0tYIW8ISEKfTHxiuA4QWYuNNFQN2YLVBNxiiIskdswS8F9Z4RvtQ==","shasum":"23c54a0da7a871af7ec45abb324cb67c57c91c10","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.4-rc.3.tgz","fileCount":36,"unpackedSize":178047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzFU5CRA9TVsSAnZWagAAh+IQAJQzhG/1dOgJ8a0/ygYJ\ngUHnom/HO8toh0fcfbgaXtOaS0ll0z0JHrKlx2uH/aBNPwQ8XISrGyGbUE4d\nRmivG6s/kSeVL1HqOGzJHOMK9UZgYYv/wFUxuLvJ1ZCZL5E13jT8jtoov+Rc\nkLNs4yJUOsGS3Ctqqscpim+jhIIQWi61qujx/58B55q94P+fDZf/3l+hEFHc\nEvv7SC359Ji4Ec5WOsurZj9RS81hREUjRKgg3CjncXs7EjLUn4rWmwBJPPmU\nbklxytBlk18xd+OHwCT0Wr7G1NWeJiLR2mIp7GqsXJ9WlTqH1VMCKWYoW6ns\nNfFc0Nq081YCugQcMT/ts778jDcYTYt0RpyHvJ6VxuHIdvhbnlo92ALVBSDv\nrMy+WYIz3moKlEvD8bBmwmUDO8KDlHqj5+xPlgLTC8ldQFSH/yt04N0zv86W\nhlr34n2qApgqIwC0X5kYWv+x5mGroA0bO3qsj8SJUjpxD4G8qVFBm+fxMUUs\npevoPJO1tGUEp4lIoinY5ZR4ijweGHi8zXNESbkdCDibrlHSzGsy4XiXnxdM\nmDCkia5HB3zeagEUm2l/MvGtKosF6B8hxhcbsk0OreNnRlqFvYoSzGx4wjbe\n8OBNTt4zFvgfFXfuwjogw0BPWEsFbA0cqZjLILGDZ4x178TCd8MPeT87fYeO\nM5L1\r\n=8bAx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+61FFgTWXt58QKB50WOe6hWn5hrL1hAN90IBcNT7SNAIgboCLyXkcRLuLA0yfZ1FOCKEJKNPHyNBi8xDimNX62Hc="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.4-rc.3_1624003897141_0.7262520141181414"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.4-rc.4":{"name":"ipfs-message-port-client","version":"0.6.4-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.2-rc.4+7c1afbdf","ipfs-message-port-protocol":"^0.7.3-rc.4+7c1afbdf","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.146.2-rc.4+7c1afbdf","ipfs-core":"^0.7.2-rc.4+7c1afbdf","ipfs-message-port-server":"^0.7.3-rc.4+7c1afbdf","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7c1afbdfafcfb81f698cea35cfa0e392711d40a8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.4-rc.4","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.22.1/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-UaJwp0AMiO9sH/rIb/62vEwV9WJKxpreCWRTvu/oEedEwOmVKLNMv3h65jCT6pN9+DCDMh0SK++vEsBgjLBi4g==","shasum":"81bda87d0dbd4ff12022efae648c573d7179b015","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.4-rc.4.tgz","fileCount":36,"unpackedSize":178047,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzGWOCRA9TVsSAnZWagAAcocP/3zoU0RPlA0gR0rtzX7S\nfpyXmdpn6un8LcDPtX6v6f6+OYAmRPB+XuBLeyNB5oQcOzoKCKU0gzRvK4JK\nmyrrI55n1mT1RfF/xMo9L2BX56f1QX56vG2mLI1qPLSi0UbWuslRonWr1Zcv\nY/gBHoJXZo2ycvES9ZuYal7aFnAUJpsWmuQnAziYfhAI7e/T/vFkXkqv+alf\nhkG28nbZzAx+46LvPJonH3xoT8RVfe6hPpbE/tl8haqwZPwn3rEKIZLLi0aX\nr6Aqi+/JXZOwEKXHOGtqFQY4b+KEF8H1tHwMcvjj7jlZdZ2RWFa4XhyI060c\ncMqefJ+A/gfOlSWgDfKic8w2uEqKFnq7Ugs6yYbrJTwxfTcF5R/MsM+rAxER\n5TOqyh0bE0DN0/m48RUe6td0gwT5vVomtefaaTI4s9vvFgdPFoYwlcYOPZYi\n5EAzynwM84ytS97BQbDO2LhNWthdat9NltU7qUBLeiIcVgbBNbvSYHVnB4Nb\ntaPXq1ypA4or2Kfsaw6Mt+dTsSoGX3LD7GF/mAiSXR31tJfHRZgNNjP02Vek\n8exmkCX1EJJI7uXANH934b1tMMUDSrqIVfOYnC8Ad4S1GazHAX9nTh1e+ihz\np13OkNA9xZ0HTlhiVnZ0VybyhtKxxYuOu0YkOAQXiDJqEBZRfQTjlHnTBu0D\nUYqF\r\n=r8SQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVxk6RUc8NBIwYurPpPDu/G1fuQYAXfWJV75fsmOBhpQIhAJUKhT5v87lJWmmYqFwx3/aZdrKvccjGee0/DOFIFRj7"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.4-rc.4_1624008078228_0.1248021581307861"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.4":{"name":"ipfs-message-port-client","version":"0.6.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.2","ipfs-message-port-protocol":"^0.7.3","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.147.0","ipfs-core":"^0.8.0","ipfs-message-port-server":"^0.7.3","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"81f944163f5a78ef15fdc23b2c488ba7f44af0be","_id":"ipfs-message-port-client@0.6.4","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-TFuylwbQPsILhENdRxzsDOQz0L0W0q9kgTVyJtH6KjjiAwMUo7Z3sn7jkNxtfSAvxzBgEvzCnaIFz3xvB1ipqA==","shasum":"b42b1213ce9080962bc7131ced1d9fd8c3457e05","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.4.tgz","fileCount":36,"unpackedSize":178177,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzIBzCRA9TVsSAnZWagAAfFoP/jnCO45s+hs1M1CVf6jS\nz2VXh1Ns/Gq0l31Jc+zfYZjx8JrGkzwVWRXAEezHhUFTjhscoSCSWmg3rY/G\npkXtBTMqijE4uAr3fg886ToJMl8dmw12+nlqOAsr2vQoppJwN35l16bIOHQE\no7Q9WfNGPsGNzfkgWJA/85pNaSRl1QziN050F6di6EMcYRU/pFsSydHB7UiJ\nT3qu4V266bo/mQ5cHTxS74V4zX9ddLGYRr4n9NDvuV4soluIFq370GMTrwHR\nRuf4LC5HonO/NdHw3hqeytiAPU/nz/20b8I6E3GRSq5IkqlmdHkBkIy2t7+h\njTSVOu3VRWywSsphMmg0ZFfRHMPAVoyembtgXjCuNxGA0NwETHI6s/SbZzL3\nbJ+dGIJPNATUY21CplI4nfiKYsTPFzPQX0215OtA3MjGMjZpbVe0wIUwWtKJ\njVqTRh0SVMtQLNJPcLWDDwg6eMfYvjKJnGu7CANOsWfAs+6fQoKSJZ5c4inB\n7q6+0sylN+EZvnMtCxriAuznxJAUAasNVx7lSLkpowbHq2ox/L+6AQEesz+z\nWdnjGM7Of8bG+s69AbBnEs06m35ec+6itXNj0tDoqBw9bUDOHm0rUAIty0lm\nHEGcHlCkGoxxtyFuGrA3iRv74Fq3l06GHptbgdvFdXvs7aIL5BFEhM2V8uGy\nJh7T\r\n=dZ/j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfTseg0LAw4JNUooOKD0taR1JOznq85tFTyoeNRyS0cwIgOhDalnjVWsGF5OoPmIn9nlHUCyg8df18WN6mGt4P1JM="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.4_1624014962693_0.03405440366713108"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.1":{"name":"ipfs-message-port-client","version":"0.6.5-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.3-rc.1+f4b2a8c2","ipfs-message-port-protocol":"^0.7.4-rc.1+f4b2a8c2","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.147.1-rc.1+f4b2a8c2","ipfs-core":"^0.8.1-rc.1+f4b2a8c2","ipfs-message-port-server":"^0.7.4-rc.1+f4b2a8c2","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"f4b2a8c204271922ea34ef8c060592eb56a2a1bd","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.1","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.22.1/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-XOhvrWRw02WfTkYaza0yEfPxINWbA9YTZGSkRvZao2UIw90EjjuS/254bGMyHNmi+//H2orZ84MrcpY7QxcJ2Q==","shasum":"f32ca707960974f5bf97f2578423432389dd4fac","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.1.tgz","fileCount":36,"unpackedSize":178247,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgzMKaCRA9TVsSAnZWagAAwi0QAJSj45S+BvMk3ahXmjHE\njd0+6re4NPGzI8Y4inuHhOnRsZntF1PEf3DQ9E+wHaCc0d2YbkIn/QF+QytH\n+qPn2NgjIiEjSYmnzCSbkFJE+D0IIFlc7EVcih1xixW+SE/0vUHCWDAmjM1m\nnaOVMKCl2XajvR0onohOzZAK8BOffopEKaKBsIkl3fY6fmNGLxCWddJHygYw\nRfme3eFd8fJdN9BswhjqhlvY3TytOTAFhiwy6ZVox9Tyind25rza4AsBh+cT\necaQqw7cIFwW7as199nnoMu7ef9+gGtkHv1eNjO2b6p9TtYctC/T+p9Kk9UA\ntNfj2c43qRpvKwG8F5mntDY/LdqmqoXZzcFzN/9/0sv5iH/WMpb0Fgy77uKq\noLaEKO8oT0Tc3plDfvfvgEPFxq3AYFjZ396OpOA8ISelTIRsrTytoF/AL0sH\nZBA5IAwXwLHVw9VeBTv4VrU5P0hqr6bwcNyQXswMo2jOd2dwgeY0dUTdBAC5\nUWAGCI8CI3wJjoww0MiGqrCl7n+FqnXaA1Q2ZOMdMZyUUCazWzpni5A8gUCr\nNDB/qR1Ot0YtmosjalnOWolM2KSNHkHCdwjs1qb0ryJDHP7LJYUTN56heoa+\nOWL9zijVgSWlYkM++//j+AvkdNkJUWDl1TdZjeY6i20ZaHdy8MYK4+ZNwT2T\nZE1E\r\n=4a8K\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCH9WPCFG3eVwteDXb0HIqw8JquNo4XjAzrKlJ+KyImswIhAOWW+9/p/AB/b/n6vltMKs62sw4sdhjig/2iF21hKEfw"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.1_1624031897769_0.8748227527672019"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.2":{"name":"ipfs-message-port-client","version":"0.6.5-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.3-rc.2+4a4a360f","ipfs-message-port-protocol":"^0.7.4-rc.2+4a4a360f","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.147.1-rc.2+4a4a360f","ipfs-core":"^0.8.1-rc.2+4a4a360f","ipfs-message-port-server":"^0.7.4-rc.2+4a4a360f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"4a4a360fbd368b8b27653a81c9301820c93d91bb","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.2","_nodeVersion":"14.17.1","_npmVersion":"lerna/3.22.1/node@v14.17.1+x64 (linux)","dist":{"integrity":"sha512-5yHajVLSxF/O3eCA9e1Si1Qok/m1kPUBYbyOGiJLkPgTgR0DGU2a7zRxWz/0GEP93vfCunvfC0SG9+WpJlZCLg==","shasum":"aac9715b4017a9b2e38fdb33cd084c5b806ac567","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.2.tgz","fileCount":36,"unpackedSize":179230,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1fLACRA9TVsSAnZWagAAUEAP/0NStT1ou3UOKKRyehBV\nR8qjNV+eZ6rys2KY3eRFQPo01pTNrvTKnMzrumz/qtdz/T34JcgN6rGoPoy2\nu21VR+aWhD0J+35MGIuXKnpEk9ZXEwSgyj+GoZDCW2js0YG0+VQpBIvRC6hG\naFZ8SLaZempR8w4hiaRU1Tm74btq7bzOmGPvGg3FZwAOwmVCVnTRIRG9b3E2\nhgYYFDlfyZiNVskZr0Edys1PN1ywJ5EGQObTEF8FoL3luj4EdcK1nRGbT6Ot\n6Tj8G8pg8lfvhr/GjiF4KWOln6Sm2OnQp2xkdgY7a3YUn+cLudZiNiyxd5xU\naGRb/JFzU43H7yaVyhVb7fmRXcOPVADnTQfGxzQNlfEmwA9GS3vAu0jwpjrx\nQeG71Zc7LvYVuf7x0hUvWNsfKMxOJk7AiN/0wGbAPYvW3ax3gSlIYJa/A+uC\nnM68jn1NFJj5OMXVpRb3wyJx7rgv2pBvF1M7Ns4cunXZUJ18E6NB46G59FzQ\nswV0/G9dlNifCmAiGkydcDMkVLA5xtmuhtXkCGDsp6HiVixhMiZvABj6//EP\n8Jsa/xIgggDtCM8ERHu8Luv3BecI4iD//zFAyQcJh1SHOUrhtZUI2K5vuufI\nfzYSOUqz2idgkbRzMTQoXrTHecri8Jy7miny1bYxIJr6sjtL36CvqxLCFaVu\n9q9k\r\n=V/qe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFRDlK6kxTFFR5PO0cGQ5p0F4atUn+5viYFCg3L63XISAiAt6nsN9oHALuOP/mECpqCb7OskY1/YtzOR8Aug+I/wsg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.2_1624634047626_0.7371437341649989"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.3":{"name":"ipfs-message-port-client","version":"0.6.5-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","cids":"^1.1.6","ipfs-core-types":"^0.5.3-rc.3+88dee13a","ipfs-message-port-protocol":"^0.7.4-rc.3+88dee13a","ipfs-unixfs":"^4.0.3"},"devDependencies":{"aegir":"^33.0.0","interface-ipfs-core":"^0.147.1-rc.3+88dee13a","ipfs-core":"^0.8.1-rc.3+88dee13a","ipfs-message-port-server":"^0.7.4-rc.3+88dee13a","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"88dee13a9246d841648d31edf0db62e4a4f859fc","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.3","_nodeVersion":"14.17.2","_npmVersion":"lerna/3.22.1/node@v14.17.2+x64 (linux)","dist":{"integrity":"sha512-++fNw3UNRth24q3U6IbAprdUJ1jX3BgSuqnc38G03Y/MajFPm5WUfnEOKDo4OXSxIy+BVdPh+5G53HR1yq4udQ==","shasum":"061122b954cae8bf99c6ba2fb77368bc31700180","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.3.tgz","fileCount":36,"unpackedSize":179230,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg3efqCRA9TVsSAnZWagAAwRwP+wcXy/xZbx3eu9eGPcK0\nWMoG85/WofyJ2qmH5SqNrD9Qf4zL6Nrw0x2DlvZXt656JhFwoDSwiHeXAsND\nnxfQdvfbMtqr0joVU5iT/oM2GcBsfaD9cK40xTF5odZcEZaZaUd1gP1lbaaJ\nNaVP7ROLs/9oboo4bh8QBn4wXH4vCYfF8bbH2EmtsKZcWL7aPfqAVuggi9Te\ntNLm5eBUDPLSfAtbYDN4YRx663dEZN5X7qoxrtGYVYisVcpaC6aYT4Pbiovo\nEgcifZuWhvQzAYOQWXAc2Y/ObELvl5fgh+RbwbiYjQf6eMqqv8oSOQDHFbA8\nm2ACZDIAltArJAaAU8xOSUTwHiL18pircJnVFar+XyGQoTd1zmrOzF+mZzhY\nlsP+Mjt1O3+qobNpzGbBk30Ow424kxkXkg6qNsjQzYD7qIa4LS0Ryxg7uxfR\ntF7AQddjXV1Dv//muTUTcROoIEIbGKe60rk7NB97qEw0BWJTO2XHxYgIKax5\nKGr3cVqSNViEDR4HLk/h1vcD5JzWeSJMNclfFHJepbokmmOmjGGx0AN6P67e\nW3UN9r/JEd0VqRcWlNvO4sc1R5pfGr+sZO67qOGuX+n4EKPfWasEI1QXtQew\npbHpF8z5XOQYSflR/InoxLZd9dOOVJUSUiHFr7hiFqMeVeK3WbIqSw3wfQyD\njtRK\r\n=4mLQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEEhjsLPRIvgX4qW5MB8hvDquEt5PJHZ1DlyE32F423qAiBeuSonlmXwd20cPN7NxGd742yJ32ZfbVTZSJaWnhfeHg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.3_1625155562185_0.5425091491768788"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.6":{"name":"ipfs-message-port-client","version":"0.6.5-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.5.3-rc.6+4155de5f","ipfs-message-port-protocol":"^0.7.4-rc.6+4155de5f","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.147.1-rc.6+4155de5f","ipfs-core":"^0.8.1-rc.6+4155de5f","ipfs-message-port-server":"^0.7.4-rc.6+4155de5f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"4155de5f78134a6cbbaa4551d1b35e8e44b580e8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.6","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-4gcw5oLQlTWBPJzzci1fmXfcvqlk3TJnpO52RiI0JgiZnNHYrDxYckVIf7R+S8uwX90Ler1NeVCaJguQjoMQAQ==","shasum":"521e4efb1b831b1ddd8d8d2c4d5f4bb0ca2f950e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.6.tgz","fileCount":36,"unpackedSize":153684,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg9ZrgCRA9TVsSAnZWagAAf+YP/11OkRf6iajIXHFbiw82\n2VFAmq8BeWv9QChvV1coAcOe9+e5oPcujbhwUoYyQMwZkFMJKH3shsAp1HBO\n4tJ4hK21tdnac/rxcjjTQOywi6ypXGdMDdcfygLL14OgzvGGFt69W/LucUTc\nXQhM5jOj8U48DidTs08FaUj6hf1jt5Zaq5cUGyefoDmTZ0kQhs7yoc/AI38p\nM6ZfAz4Gs3pbMutbfSGFXD6EMihE0O/X78mGz0r2GBeuIUoCy562SYwptLDn\n3sEiSGRBrLd+g4EFXo4qCHPu/QPx6JYj+3Cvp9QIRR7hvvTCJvOKnWgMI94S\nIyJgShm+rgbAxTCDM78eN23f8UhhUwQff2AFjP+LsN77S49OkIG+9jJ9nA7C\nzxrXsw3RSNEI3dRYY9ZrWYDxAUV7F6avYR/KhWIWHGvvVuxcl3BTVn/GTBG1\nPyWuMDaDHKszoJz0qgZU+aIhcvNJ7EF/X5sEuoEblptZtyUXmRMs33k0EODW\nsvoRELHyZEcI/wj0gT3Aw/N7+4ESA5wt8z50qWYb38IY4LiR76mS7qVp5KP+\nNeGUqU+sg0FzS7bAcD3xbU+Cfvs1HaortvSU7AIFwbBGP59B74J7vmJEBuW+\n/p17T+4xL6kymF+gZK/R3OPSu55ENSl+h96MPbliMntLiW/0RwMXGcdfG7J3\nlikP\r\n=rN2z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+Fm7hCmTAkvTcdshWkdJF9OU+jpnFsoQjxhqNGRCOQgIgHbXqjDYI/QG3gWw6Ev+fvbzq5krfOQYqGMzFrdz1n/8="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.6_1626708703683_0.1432653078234445"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.8":{"name":"ipfs-message-port-client","version":"0.6.5-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.5.3-rc.8+50361a7c","ipfs-message-port-protocol":"^0.7.4-rc.8+50361a7c","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.147.1-rc.8+50361a7c","ipfs-core":"^0.8.1-rc.8+50361a7c","ipfs-message-port-server":"^0.7.4-rc.8+50361a7c","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"50361a7c0ea69489bb24f6922319601e3fd919ff","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.8","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-4eSnRwRVjfPz7lhHb1FkZQMaYgwH/2PL0hn+rh/aoO7oRxf5tyTa612l9B0vv2UO3Xb/bd6pdQtucWWtbdqmAA==","shasum":"afd244a7e29719396636248917fd1665c3d381bb","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.8.tgz","fileCount":36,"unpackedSize":153684,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/9HqCRA9TVsSAnZWagAA4N8P/RwwC/xgRWoTdGi1PlKN\nHdo6h1iXugTf7vTlpzAYJzaHy7epXkESGIDAD+u1Rp3RyjipHYF5CFgMJhve\nnlJEUxVhUtAw2NmFFps+Iv7/W+DVFcLvxCpAVXBOAqjz4Bq5rKXEDPkuo2sZ\nT3n/y/aNN+JPH+DYbIOBxrQS0Uiwyr05fPxGBCpG0LXRX5jsSfSb34yOofgo\nR5kLm+gnoBb214EHobfij2isn8m0znTuBsDvqituJkfhLxp1zbr6/hSLSrdG\nb8MDhzAHZgyibRVfRWHA41jnryvOnqlpX7aZ56KT+STQKC+dzjcZJPNQloIz\nvOttwtyDfxFHIqqppx7i+FOpIi2NoYn9X03JphwwPEXmEI5x4m8Ilg8wBtml\nMkPVgrJWM/rwWPc+CujHpKVHZr/O70FkFJUBYGyYz3HZURRHh360pgAV/bjY\nQ8y9s/nLLYGVrTJdfllBjOINFiqhzXxGQ7SMVU2k5aBA1a6VEjo8RVasI0O9\n5pakwIl0ooILB3JPkw4NpeLExxy6H1D+JNyrGZjBkpTf/jGhZvy3wliT1oXK\n0E3TkE1YV4eJk25L4a11gaLkhgoK44jeD/NWENtYcWJyR1/vxQpqYIsp+v5U\nawnldw3//bUb0QpvktEekFLu7s4yC1Q0xyoYoQNkDm+C8NvWH17OMuZer8MS\nDwXC\r\n=jPUd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBNZVTcyVg8Q05scOZGnCf9mU0R7yLEkQzYweHXtr4ssAiAck/jT8B5WCnBIsbK0rtMF1FTLO/b9YX0cLNE9WloOyA=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.8_1627378154502_0.6036849777685411"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.9":{"name":"ipfs-message-port-client","version":"0.6.5-rc.9","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.5.3-rc.9+09dd763d","ipfs-message-port-protocol":"^0.7.4-rc.9+09dd763d","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.147.1-rc.9+09dd763d","ipfs-core":"^0.8.1-rc.9+09dd763d","ipfs-message-port-server":"^0.7.4-rc.9+09dd763d","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"09dd763dcedbdbc52c590150bf9788c3f17074e5","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.9","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-kvUKSSF7awu/fl71pE7PvIGAPcu+rAfUierYl0h3BdSrab0QWaRZJP/YVHiH45qhQQDeldVKPqCCkuGxl85IJw==","shasum":"d69c6452a58a955551dfbea9dfb7d8de6f286ab1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.9.tgz","fileCount":36,"unpackedSize":153684,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/9l4CRA9TVsSAnZWagAALCkP/3sdSBiaI1XGfbURpUJ/\nCEoKhkqI7A+eUbBDgSNmXByI14kVhQaBrm2tHpSiUXuRs9SuYa7nSYoXMkSl\nsnEcZH04BYfHyFd6M+AZtijvsJB0PlPog6vwaxg3Kae/AliVj9G9pxRkpLVw\n+jugdI/tglll94W9uAZIDN5phauBbt0fgm38lDOMB6RyEsAkMtvFDEKaoGdV\nsTK0JdXcmn/3asEGur/PDVbiKwbWEjtiGz3bAV/7bwLo1aaNdzhnclh6LXUb\nnqCXMWTifTk9cKY8RRvG4Kogp85WUSnq7E+35cvpa56eklp/rWih3W6YMX3O\n8wex2+w47MZcROtBAgjO4b0tHkKQjHIWPSFl9UC72vZcckkA9d65cxoF/YxC\nl69g711RUdr9fRHrmr6oKJpErv2hG1Ghs9l5QYWIh6RabgKpGunPXZV9RZm1\nhNdhP27EHg/jVUqA8p/bzioc8FYnpw5uih68o8jsFtVZZoxUlzadm0pqxM2+\nG1XXfnPgWsWY1/NmrQOUAmbwoHrK98rL/wZv9pH9JhN1lF+hhn7vW/N4lekX\ncGksk/kWlUXo28wgEzLTTbXXFX2CuaB2Kjdm3ia4ugp7YjD2WtvQcihkWEz4\nm7/Chh1dCC1zpiO+s1Ho/dr1K6wfya/jP4tFV9bBdLbkbh34tsG7wzFKbypp\nMldm\r\n=rfRa\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkW3Wl0KTcuozaX9eUcOMB8kxXJjlR2aKwWb84+yUm/gIgKorYCbithG6afhjAJ2r76VS4ZEzg9E12EWfj1uxGt9Y="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.9_1627380088697_0.2557569179672856"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.11":{"name":"ipfs-message-port-client","version":"0.6.5-rc.11","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.5.3-rc.11+32f3424f","ipfs-message-port-protocol":"^0.7.4-rc.11+32f3424f","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.147.1-rc.11+32f3424f","ipfs-core":"^0.8.1-rc.11+32f3424f","ipfs-message-port-server":"^0.7.4-rc.11+32f3424f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"32f3424f86c9c7bc28155dbacb12edd97d9b84e5","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.11","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-bVF/XgwofoefxSuHwkbIP3qAx6CdKFL48R9t2qSHb9cUZOZR9p1E2/9wU5IMFBlSyuN6Yx3NwCwpDnAU/2unHg==","shasum":"002a23f5bb8efa7e2965f125830bacc1bfd059ad","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.11.tgz","fileCount":36,"unpackedSize":153690,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/+JMCRA9TVsSAnZWagAA/7gQAJFnQMSKDh7VCPtUD1Dn\nkZk60akVfuLwSUBHkjITyGpC3vtw8HTzuWyzB0jgRiFMEvi1gqq4Tzci9F4A\nK159jvL2MKyzn3sXOjBncTx2gBVpAZbWJKw8ZZwE3P8j4LVfQfm1CGOIke7g\nghpNiX5/lKMNA5wH90FyQlhlDHr1jdMFJMHnoex8eFud6aBwlMLhjZWLlOFk\nHT3SqywK9hRCzJyZMt/6EXz5mef3IiMFXHq7guyBHHm0X4ozdxsGrOMWSfId\ndOuc5dhYfRMxUZsHbZA6bmTAoG8gavSHN+ANsNd0n8y6jcq33OZobifNpOUw\nqvptTAj6FcCuXt3XodxyYTf1iPZ/Nj3EHDwUbW+OHDHXpsLJevjpe8Iq93jS\nOiQUOW3vzQkxRfvVK1WEWSZGbS6/69PHTXi4BOqlbFkqtBKbUdbUx1t2+WPg\n3VApMIXPqewD+bZqmleKgxqWbFwVawqpNLdQLsvdvqxesjafpgGYykB1aWVC\nakePoRZAGpry1vpvRogjD1labczx6ix1V9Nx5jTB1cjGlQVrO7xToLfsJqPY\nyQTaCjFIiwtgEwTxSsNBVvOLi20z7wrXQeECq2EEb+saswaN8FiXPBKHdu5W\nY9t/lD0CFqIiT54zkuCwzzvtxXV01ij/qVfD8MuC1Fdcl4A9dYCLVhGo8orr\nwFjp\r\n=e08W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMnha3M9ZEtp68u25SmlsOul+Qm7wzVS5u+5kICVjcXwIhAI7sTFC5Caz9e3uoX1cDwoyP7lLTQzb1ix9ary61QGxg"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.11_1627382348262_0.7330752159105121"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.14":{"name":"ipfs-message-port-client","version":"0.6.5-rc.14","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.5.3-rc.14+71bb03c0","ipfs-message-port-protocol":"^0.7.4-rc.14+71bb03c0","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.147.1-rc.14+71bb03c0","ipfs-core":"^0.8.1-rc.14+71bb03c0","ipfs-message-port-server":"^0.7.4-rc.14+71bb03c0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"71bb03c0a3d5e64a1ba617341cd706c83a7346fd","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.14","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-PoJ9BhKQhRA8CoryPgSWP3vPn4GbukpyzWh9IRjEOv78GY42bonLB1cucIch8TZd7nfVdYAm06HnsL+yU1F2gg==","shasum":"f5a4999b82b420ea6572bfd9ee694a05d698335f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.14.tgz","fileCount":36,"unpackedSize":153690,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg//oHCRA9TVsSAnZWagAAFqQP/1zgm1gxxKxaBNvt6b1t\nywamNeyvGfylBj6563xl4ZW9FI2TAG1sI9QcxFgmXeuTSsQjY3vOTAFDGe02\nd28YezVa/ejZXDiC40WjRtmdH91GzIuCH7Nz3F+LvAKoO/ksgzKK2UKeoeJM\nq+RBP6J235BFrWWKDxveQ/GgWv1MV2D3peWArKKVR61vGYjSLZsRetZcblwN\ngnTqUVjyYDCS1smaV2X7NYegUTnDqGMB2ZVgJr3pukIK0VzJRINczdYyoqph\nVHXxd+kGjTd04ZPqzz8+JG1EBC/EhNZv7r7wNxcHOLfJqR2++RDyc1OK897B\nmp9q9TszFRlJojMu8R3gsgo+NikY8zQWuNjo0AxRezSHYkwhqHMs+PQTJ+nj\neOpqh6lxK8O0cd/MP7mk3xWzmX3I+M/jSa8G3DMFGHOM/gbSWifqeTO92A/s\n11r9G5XH0nVGTqXAZd4ULS8wsKGcZUtOeyVbG6ClH2fWenlEGd1sBmnKI0hG\n2Ve37OWftm7myNxR/As6/N8j0jaTZkz7No3eBcic0ieeegEHH4pQCKvRpNSx\nBjpy2b0eA+YNVsweIK3iJzWH/AO4lD/wYlL131G95/DT4TANrD+/Cnt1WKhD\n+2IYZxb2EBXDsukQmCiQn6u0ah2pXUa3ltrkL2o2uh3j5Q7sjXwWZPhuAhKM\nhEfM\r\n=5Etg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIATTmRvXw4s6v1FWlRjXjcDwD0jd39YR165NY165GaeQAiAHzsYOP8DcDw748ZhGoStai6SnXkNuEvRYsECvoCbZag=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.14_1627388423584_0.081862048567231"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.6.5-rc.17":{"name":"ipfs-message-port-client","version":"0.6.5-rc.17","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.5.3-rc.17+3aa4afb3","ipfs-message-port-protocol":"^0.7.4-rc.17+3aa4afb3","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.147.1-rc.17+3aa4afb3","ipfs-core":"^0.8.1-rc.17+3aa4afb3","ipfs-message-port-server":"^0.7.4-rc.17+3aa4afb3","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"3aa4afb30b2dc88a8b3cc2442336fd2583e2b867","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.6.5-rc.17","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-hQNNreij/Qq36DcG3CtjJlRnl/P48QtOmr6ZSwbI2DC/gnrVLeSa2x4E4rpdSy6sO0IreOqRA45GM0x1guGDOA==","shasum":"acc0b6373b96c0cb7c09b2adaa34fda5f4c48acb","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.6.5-rc.17.tgz","fileCount":36,"unpackedSize":153690,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhABb8CRA9TVsSAnZWagAAfWQP/3ZAncOYLkRj2CsAFeDA\nceQVDe/p2cLL43/o+jXf6LV6+wcPzmHfGa0nkcyWH2qJc+QSa4ySrpWHhncS\no6CVd+IQg+cvosk9VJflbsmAZzBfRcRrFtjRWy1odkgU44tUZf3Wtj/u0h2w\nDhhlTbJklOdV1HpVQjotHZ2uD1M7+Sh+wDx9uuixCfxpJsBdoGdb2aMhRdNX\nxh0vFdas/6kcEhY+rZWt0b568mlJZJGop1+Kwhy9wVHZeeKcZdcGogJLhbmi\nDQGDAOouxKm8peh4SdBOZA4Q6d9HJa2k7/J3WzPJnKEIOHkxdQgNkLVvl5aw\n8keAdl8+J18ulESepZp73cFaT9DSxt+2wDR3VjDIq8ntzC74z294+fF4y+lI\n0dZ+X3lYekvoxKmgO8AYnphUz65THqdjBvnwFrmxp9azR/zeHKBk88M7qAEo\nyE0PkiZZtl2PQu5Bn0085vP1pmrGlFZYmxz2G7wfIp502ijnp+UIMtwhGnJU\nnNMMnvKFOO7aN0Up/GBqRU3P8agORigduDipFv+BdVSiw3KAfPjJnfJviMs7\nny2YGhw3sgK7DP45EGkdvywHPrz0osDUZ7/1xVoJrQ8uDDhl0FR+JUZSedRf\nCAybpw2pNshN9SprFkBcVQK7LUkpnOqYF9Tdoyvi7VzGKTgGedDgDpPAKtY+\nQ0ep\r\n=dImo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIbD6waU1tqPhvmF1+kz1ES3sEzKFXmtlnuxg1V5IYKQIgbcf/u6FvEfLTZO9/qCptvjISSbyqX9BwAKqN4BzE+fs="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.6.5-rc.17_1627395836574_0.4659350992659186"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.0":{"name":"ipfs-message-port-client","version":"0.7.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.0","ipfs-message-port-protocol":"^0.8.0","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.0","ipfs-core":"^0.9.0","ipfs-message-port-server":"^0.8.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"ef41f924e415fc2acd30032e2b484bc32f042790","_id":"ipfs-message-port-client@0.7.0","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-bZdPoyzaLxbP8ePRly/GZaQTVpQQE56DvGjd9WlfQQGAmOaDOROO8d4nV1eVzwbC77mQys3ZvA7Rx6zgO+Kl3g==","shasum":"a0f3f527796af462db2470fd29ddebee9fc3e892","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.0.tgz","fileCount":36,"unpackedSize":154597,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhACFPCRA9TVsSAnZWagAAcPgP/RYDjGHg8aP9Ya8W6QcN\nqKN8mkkgb7hosImBUVn43B6PvqFjX18iCyoV8gpqYl2QbbftxKeCbj26T98P\nxwHeQyxk4sZvU027oUHFVsdUcWEtBtvxOnQojQugMUFVtDq+9HUqqS9odM+P\n/WYZI1vqAC3ncKx7wT+TNJbOIaxhWgHxYeEV8B3rCYveCN4yxuYRirwRpdO3\npwj/Zu53lkb89UZeqQFReEJZp/InHWrNBp9TbNUiNkdpslE4v2LNEYd3iZUh\nyFT5RXbgke8I2URtqqWH15hvP9v2x4m1NvO5wdVzrl5GuZcHRq91yWEODnKd\n46af2eTfErapIsE+mrCH4wlkmmlbOrf3VBMUDu8RbKd7z7ivl/c9+0ohnzKk\nMedPbp0Bz6xEUsiDws32NxnLtJZ4n7ODC1uIuE2L6tW//6og9ZwAAd6/k5pY\nuMdY6/VxR815+heqJJXxRB7cBRXRdRMn5OQswvsW4ZSErpHKdDJOxZY03C6T\npG0nKLSTILjxdHfhgYKwC4eyjyuR4emYciW0HxZ5I8AOAg5G58/7kcJTD6bR\nbDOdEq2c+Q0FxQRgk00K4g0K82kSuXogZLSb04FlffIQvWql32R2f/0zwRj8\njuxSO+OAVEHpL4aLdL/cZhMDmaJujOwJ+71l0k6ldbvnAatyA4B0rcvWJF3X\nM5oW\r\n=sBNU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHajVhdFyitg6ZKas9IZoKUjAblzPozat7o0q8180GrVAiB2nYl3drRmzTOEm9NXIAkKt/slmdSCommOCRBbSjLP+g=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.0_1627398479758_0.36013632586723165"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.1-rc.1":{"name":"ipfs-message-port-client","version":"0.7.1-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.1-rc.1+5c43562d","ipfs-message-port-protocol":"^0.8.1-rc.1+5c43562d","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.1+5c43562d","ipfs-core":"^0.9.1-rc.1+5c43562d","ipfs-message-port-server":"^0.8.1-rc.1+5c43562d","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"5c43562dd3ba2d2325e297e0a42ef441f9fd2615","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.1-rc.1","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-PG/h878nEPiaoUdq3lQs+SysAaUUhOvmETxNmOTM1NJsRmRlODFCbn48ucYdKTG8V1hPAmP2xCaUnjVSvR1+1g==","shasum":"4d4a35a7f0c77bbb46d2c2ce8bf88405728878d3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.1-rc.1.tgz","fileCount":36,"unpackedSize":154681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhAT/PCRA9TVsSAnZWagAAlbsP/jM4qnLfRnrbkgYi8sbT\nob7nlMiqibckfXojTHF78vyjsTGNeoI6ML/pcQK6YlaGrmn1g3ehh36Ca2iP\naysE/HoDNOpb9dzWv4Fp9Xiz73ogGmP+qsrhCYzRcdK3GhWVCk6Z724aSdU4\nC9TjC1Qrx0BOrhppoRfwpjFNpnE8I0VKamPoG3ir8jkeV/8XyUEnfIyP6j8f\n1uo+EmQ6JSUmBnDcdPUVogRZA0sdH8UoAJj7zc62PGmbqAba3hL7po9l94sG\npKWyEbzcMb+5RvxSnHdqz+7QENP9W39tsdXNruw7vedU1b5vNHeGqiOQC774\nzHyp8UuCZXvEs3baaWCk2aTF5jDraHJNBRvxQuIzDiaRebBeUWy0Duta1PG1\ng2VIhgV4V7AaGxE7tIYFkr6SzoACxC+wtzAayDLIFcw9p5FW6GB+TRTDzX6y\nEpnn2lWuQeELOPZ4Xx+6cb/wQ+I8a45x67WDKRqm2anPVMSBZKB/bjwMZ/xy\n1eX7yjQ/w1M/QjoixmbsUxa25tP84LFwyvV5oGNEPHi03DXb9ZXhO0OF7A6u\nE+mVfdMgrwR9MsDz5Pm0c/UfkLngp9mAWuZyhqFulQckQlraSAjSRyNkpp0M\nUU5MvfGX/JB8+nLiOGkibSxcYSgDTXJSaUhItyYsZnvXDDywDgmkwT7ggdPO\n+mr8\r\n=s3RQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvw6mLvmJt0OZMFRMYah5xdLAQns+yQHmJ2wLXTAmUHwIgc+AOIH11Y2SHkXKGoC6o9+xIn2MkCwU7CrLYmfDdpYg="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.1-rc.1_1627471823082_0.3124374725747545"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.1-rc.2":{"name":"ipfs-message-port-client","version":"0.7.1-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.1-rc.2+fa015c9b","ipfs-message-port-protocol":"^0.8.1-rc.2+fa015c9b","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.2+fa015c9b","ipfs-core":"^0.9.1-rc.2+fa015c9b","ipfs-message-port-server":"^0.8.1-rc.2+fa015c9b","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"fa015c9b2291c375a5ecd86337831eb1071932e8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.1-rc.2","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-cCCGtsOg3DBOnWeTCDAF1vKP4K2myTnR1yw9YWe1oCC4vGit5gvyMCowmDtWfTXQXhtlb+TWFNrAJ8hg2tcpcQ==","shasum":"16dd111206cc85f8db1cb99141e10be8c308636d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.1-rc.2.tgz","fileCount":36,"unpackedSize":154681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhAUzGCRA9TVsSAnZWagAAoPEQAIonmi3OhF1TAxRgyWic\nmBHAo8o/AzWzP+WVCHu48Q4yXAdAoDjR9wdZxkERgjXvEA69ax/N+nJjvsD7\nPCCmB5jqvoy74mm+WLt6ffDZk4+AnK/3OMt9K5awzbqaCSJM4+PXFsKeoAQ0\nuWPEOwHwfRHxbxg/jivoMmSj0FOzsOZMrjzJfys4jhKkMksUfSep0V+ZRmKw\nd61ACJzQgP10R+jjBNLlF8kAja0MphgXlsidKjtOvvr9gAY/i3HALIwl/chE\nM3u+XHSEUO1Z8kifGQg1XkPRFurzPj63/zNky+tnGBFl5/7kxkdMy2hWHPZw\nNctAeL4kIVjzElvyCGJioMFOq7Y7MC15tLs1YhtB0nwmJ2Fu1wHbKaFQR8/t\n8UPncPlGq41ob0du+ctUWm80JolgsgSnjUmCzUElmnuuZbA7FoNqoPqQ05cY\nu0zIcGfGk8ecbu9aW+o8Fx+XCiZxny2DdaImG1ODPO+YJdbxvBuDgtFeUDHx\nxz3EeRo0zqOKm7wOJvOq6xH0mlgf2jPp59vTTfGkUyDOYys4eNKEgUvgIHCT\nvGjgO8HDaOU3dVPv4zRfVB3TVLeV0DvTDgIQzf3W/HJoGlcXojuVmmam9XW8\ndj+joE2ayKXDutqpjPBnqmbNLu7E9Fs0P2BSwzuRP7nLBAjCSdG7/2HJ0BMb\nBf98\r\n=+HVn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDm8PnZxh5LwwJ0+p4mkkYsIz6Es37gcDg4ltWciGGNJAiA5m/fC5Ggj/UI9T6WNzURaPre5dcEKhxFd56mjFPKKfw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.1-rc.2_1627475142093_0.3730752634246335"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.1-rc.5":{"name":"ipfs-message-port-client","version":"0.7.1-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.1-rc.5+43db72b8","ipfs-message-port-protocol":"^0.8.1-rc.5+43db72b8","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.5+43db72b8","ipfs-core":"^0.9.1-rc.5+43db72b8","ipfs-message-port-server":"^0.8.1-rc.5+43db72b8","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"43db72b87f0153ae4e9c46aada750fbb85d0bac9","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.1-rc.5","_nodeVersion":"14.17.3","_npmVersion":"lerna/3.22.1/node@v14.17.3+x64 (linux)","dist":{"integrity":"sha512-6XkI3WG7rQOJTsfm44LVrIXNrl9UTKUMxS41tyvFp+8aKgDl3v4t7637+A58yVeTwltpy+hza1cEeTsSVdcdeQ==","shasum":"757a7616f4a62b473db73c3263260473c7dec5ca","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.1-rc.5.tgz","fileCount":36,"unpackedSize":154681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhAYxWCRA9TVsSAnZWagAAIVsP/1JByra+//QD+SqACiVH\nobGJCIygx2qZQZOwonDO6BVT1wRZkwxI4c7ZgUkGzppqS4neXcc9Pdm/BRe9\n0/L2nIzc0sbeXyWHgeIuZuKYTKqvtzIa176TB7I/fVJAn0US5aozocXx8g1b\nkTXbGXm5Q2sYsyIErazuq1scVBbCi5E2NZAmmXs8vIVgWM1bATMRza73SW87\nTNsfCwQn9qwfoIcLzd6efgLNvltBDVMrri8nIYPtXAVyrvzr45LuammiZVCz\n+NBapk/K2IQ9DCM04x6bCwKhFwX6Wnb8sQ+PGZRDFHradYdoc9kY8hZEQ0gw\nlopNROmWO/eQRO/8AwBiowhAzo8Sv8u+QKpV5UhCzzJCd5rd9HuonF7QJypH\n/ykm1XEv361KpMAp2NpSwnvbGX+/PUI8/LBZ95+tLOZdpTeNKDIanx4493E/\n/dtprOM8S+ONlbfRy8UzFg9O89l1/oHyCXfPKe73wQjqzUWFWSjWhmQDQSVa\ntpX+IWgSqDZjmubYOFvQyq8nlLRzHDJMzZZmK69HvWUNmxztqnmipM/9fqcA\nGwUoswesCz67dju4Pyf2owck5pQiJltIxJp49oSG13AjJ4QtIcNu9rthf0Pu\neZh7cSfsY8zn/TwARBztIkL4174SRNhc5MvBbY8JshT1TBax8k5zDiyNefs1\nACWT\r\n=15oB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQClzwybGpOICY6uw9goE9/Cs2fa9hCiproRqjO8eCBMvwIhAISf1GNmW7ju52d2HUvaLsJy/NQexwqWODK4FYyWKQRZ"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.1-rc.5_1627491414280_0.07940222775294625"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.1":{"name":"ipfs-message-port-client","version":"0.7.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.1","ipfs-message-port-protocol":"^0.8.1","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.0","ipfs-core":"^0.9.1","ipfs-message-port-server":"^0.8.1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"dde3d28b4a0d0f74d73c0c0b38eda2e01874a2ed","_id":"ipfs-message-port-client@0.7.1","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-jyoVAE6bXDuf+Pgp0k1/8YynKhC+SYSd/dGf7i45RF3NLijpV5g9vO/PwMHhT5edjdnrMbdwBXJk16zs7kt+Ow==","shasum":"f79730e13d10d20c4ef0379e6d756100439aae35","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.1.tgz","fileCount":36,"unpackedSize":154992,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBDIQCRA9TVsSAnZWagAAbnMP/j7h+nENFFzuZayULJz+\nf/IN6AI75hebClDSpFMXae+cJcxW3Nw0DMzV9akM+LXizOUpc9SP1o58np6T\nDCmGhpmNueperH8mZ9BwRePZjjb5M9bV94wG2Q3hpnlwRhduwE2jB5nuOwLV\nMF0rBIIb/MKeK8iVqcpknwC+EJGSPKcx9VlKQZ8yItutToXai0hSZiBrRKAt\nT8VYPBz6Vzl6SUmrFQjI9x9yVrtgVBgPOLfxf2UpKo4CMeECboxtNH3ZFofh\nD1Kwygt7SufJp2ixCtpexBqmt85Snk03C8lD9tcCWMQJu+RbTQ97/M4eBclV\n+Se5IuXbBZ1zdeK+44ei0atQFM9duECjclg1Al8qB03VS6hXICA3e2DEkLAE\n6Ezgv8fmyiy+Fn5L0ET2OoFOZs2Blr1kvCKtdadhoWJbWuV4gXpm6gXKaSah\nM01kuOBp5opC5BImdA4FqbGz6erFeci29Ppq3mNAthXBW7rCjiK7FZpKviWC\nQzti4jSGdls97MVve3bMfN/zaD6m0qyFIum359XG+UvBbYsUKvJrVG5cGBtm\nNItgapk8QIu4O4df/gc2LEL+v/LCVpLtdxLaFa09i7LNVJaFy9XM86TfA3ds\nhwVc7LaXZSKEtzVzs5W1CLxMXdEURFp1OX9m+Kfu9STnWWoN39Z9lknIymHz\n4MSx\r\n=21tJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID5X6dYv43i476MVTp2ba5Vd4lXrqPjOup3wQcCmpsB/AiEAj4qDSOe1WQvO12p7kA4oimoejiWcEKrMNib+1D3y2T8="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.1_1627664912577_0.40485964643851835"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.1-rc.7":{"name":"ipfs-message-port-client","version":"0.7.1-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.1-rc.7+fa78b4fe","ipfs-message-port-protocol":"^0.8.1-rc.7+fa78b4fe","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.7+fa78b4fe","ipfs-core":"^0.9.1-rc.7+fa78b4fe","ipfs-message-port-server":"^0.8.1-rc.7+fa78b4fe","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"fa78b4fe1386a151422bbccf33818f3b15fa36de","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.1-rc.7","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-ezeiunHmmEAskTuXdWCNj+egVjf+YdSA9BAielLvg/bXxWQNKYrzzt+zAbivxdHrn5APoNItyCff4hbAaaeGWw==","shasum":"5080506687248774adaecc498231ce79948082f1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.1-rc.7.tgz","fileCount":36,"unpackedSize":154876,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBDdbCRA9TVsSAnZWagAAZ+EP/0hCFpwP3NQ3OpQT/QFf\n4yPMOHsXVylRvJJ5ERiHmVg14C/gTeDe5lFS5vqrN9QKYs4LAQuD7Jcd0XPr\nW1se5bT444iT1DsY6fn0h+aRdacyKkUqDoMguq+aPCwSNGoE78jEPTc8w3HF\nahW3msc5vp4JOhJJgFRS+zEtkT6MP8ZRWpNTlZsYT5SKUPWR/XzWHkqFqLTJ\n90zFdklCo/idr5TLP/2bLn8AkfARtndSm/+VLefCm5yWJqTh9ZP///voYqjz\nzz5vBkUdJmxd2G4TSTNA0PNMc/Plm1cJeaJMeutnWYBjJtNEBv8XMCJS/qc6\nUEq0s/81kWi3c8DXwH5FxW9m61Vkpcq3sUbROS/nlWuR3cgoA+Rg3AKQukqI\nO2FCWCVMv64Ro4ugGWFa0u6eZmaazAkCTJlWlsvcAIFV0fTIJN/QSZnoQ+cC\neq8tx9LsjBxR/467WcfHiG/P1rDQSUGuPWM3eql1X5c3edYCT124kXTlgsHp\n2qj/1BwufknzAI6dtG+e1ZMC6zNqs06yhOJAsvtvdNfJPXfxMAXwIYTDdh/v\nW/+EOAoHQ3a7miYk6aO5PLG/SV5Pu2bs12H/AeCHhahko1WDRaQwmV7R/CmU\nH77wrGTCSyG9TH86yyHL1UGZXLSC2K3tocye6IUMEL/WJe1ZegDs1zyORuo7\nib2k\r\n=m9W7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDeX2w7ugvhHZ4RBb48Mgqxy7VU8c3obyFzUSo+RFj7FgIhAKPcrvIAq/hy8jzqXtT++nq6jGCow8+E5+LKMGORgJIQ"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.1-rc.7_1627666267421_0.7346179737273117"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.1":{"name":"ipfs-message-port-client","version":"0.7.2-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.1+48f655ad","ipfs-message-port-protocol":"^0.8.2-rc.1+48f655ad","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.10+48f655ad","ipfs-core":"^0.9.2-rc.1+48f655ad","ipfs-message-port-server":"^0.8.2-rc.1+48f655ad","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"48f655ad4a2ec96f84c4f73082919a753523408b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.1","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-6Oh0KzQcObEonFh0Z/HLPL477v++kG5IJfT2Ezf081hNtzKT5xHjqvHbp8lIpjGv/it53bg18NLpnS8/P/+sjw==","shasum":"bf773d88c39f1f1cd6d32a5c94ed29a2a38680f6","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.1.tgz","fileCount":36,"unpackedSize":155077,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhBEuYCRA9TVsSAnZWagAAZwQQAJhjLS1jk7FRLD1i6ycA\nLSRx+5DfOzEo07Ix83SNMIuN8NlCWr90yslLFssUo8oLPDUHoQ1+K8TZ6Qp4\nhVU6fiBNgKHuxQmRbvdR0nr0Awktynssy6Ku8ymNj8Cql71HkNCviilXrMR5\nzjxl0Mn+8qR/P/oWN8icx+07L3kLdCSL3Ywg7CbMlzLmiBL0zKP832obU+nt\n2fNofWrd0rjUxzKMiM0j6XWh7cBHOgVyUbyT2BI/HHKnM0GQGinCCjatEvYK\naYfCGHkPNJ1cajLiWBnbCXFIgBvfvAzxwWo9h3Z9HzXa31MeI4NV8lFmmbgh\nSO//ZzZeR/trlrfxjEwx0yFPak0jjlYCV0Da7ZZ8liXCt1po4JmuOwkYTcSl\nmFspd1aB5SMX+BqIgnUngPMn2pmamDRbjr/BxT+3irG15ajSIYpPK0QXlj8q\nNj5IMgAviI5SDKEMcwOcbk5WN+iA8Kl5LAILXQxSokiQlHjGu9atMpPIHRU0\ndSuOe3KHSW6HDeVqtMJueXKKGpnFCoeiH3Kn6LoP/RLGLsppX1DxM9MJiuJs\n/LOZfemU364rdM+9Zeei4l7ofqM4P/ZcKEJAgBeICNTNrQEcrM0HGn9YQ+sE\nEUOfZjlA1NXMa4KXWrOGERM/v0QbADL0eFdOdJtnVBQeOP5ydGUNu0OMMY6x\nT2iF\r\n=KKLm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCT94bicUuWT9TfOsC7p0y638YuvCdpfQOarx+0/Q6MCgIgXKJUoPMuZFvjld2MYoOH3jd6A/b+1xi2o+r3/MSULeU="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.1_1627671448779_0.8094057469982217"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.2":{"name":"ipfs-message-port-client","version":"0.7.2-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.2+1db6b88a","ipfs-message-port-protocol":"^0.8.2-rc.2+1db6b88a","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.11+1db6b88a","ipfs-core":"^0.9.2-rc.2+1db6b88a","ipfs-message-port-server":"^0.8.2-rc.2+1db6b88a","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"1db6b88afc5647d3a187e0ca4199d8ab2082c629","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.2","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-1BXsOPvhw4/1JIiHOa3thRIBEJhKsFCNkEXw1zEcl0hn9CS6d60UxaArS8wnRbrz6DbpRVDA0eMkyuvNJnXJbg==","shasum":"955b9f6ad8a1773a454e9f75d0d16eeb85457400","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.2.tgz","fileCount":36,"unpackedSize":155077,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhCpu7CRA9TVsSAnZWagAAFi8P/3hj9xxkq/7b6LDe0kMQ\nq0zvT0To7u/kNVOu1JlMnmEGa8d9ZHdKqdzpdUlQYHpD+TrD6t+06JWa4cZ+\nreh6wkz0lP2Ht8m/qNNp5GiGXKwoeARwIOSTu15+GPe6r5TtSxWKD8HoOYwK\nadLjNVjRNQ9rmN6op3chhQCJ0u32BQboXui4soSp6hxAhi5W/MVlJOj40t1k\nubY5gTQLBo6rOJC8A6mt57i3cOlHISQRGmYzc5qDsaQ6Ovb/FoEOnb3f/FQq\nyXsnbVnQLFqHwFGBXVowSMxscEq+40R+iME+jFx9yuNucT3B+fHdlf5zHyXC\nrh1LBzKghAt3ZNEtIE5coBDSF0NoyRisuagTKe6qumN79CuUXCiW44jFRC6r\nSodjZXpvABgyX9/NDWuFuBsxxLiqBsGEGNsE80/3BYYSkF3q0UGyevOIBD7D\nIb7tQal83dYx1KK+QMHXdfgkSPGKMLdPDZ0R7K13DmcEo/zBngGz2biccHuA\n1QsiHhQ5SmL1D54XoLaRkyX4Pnl7/byKSRBjB5+BVUaamD99CWk8ztMtEgFp\nfjgkCjPaQaRH2topsoLl8y4O/QmxnYI6N9BU28a9ShlzX7F7whi5JPIMS1Z/\n/4jN4yXVAdbbJjm95umW3v80emAGqMgrYCWzyQuwsAPRidvLydAcNBZ7uwhY\nr7oW\r\n=Yo5J\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDEe94TNO2gA5RtTfw1qIY+3XpirxY7PEdrlttj30PPOwIgBuMrgZrmW5dg9rhTe5lnpm1cHfgn23l5miDMBhrI29k="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.2_1628085178960_0.8256099135394126"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.3":{"name":"ipfs-message-port-client","version":"0.7.2-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.3+6adc3fa1","ipfs-message-port-protocol":"^0.8.2-rc.3+6adc3fa1","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.12+6adc3fa1","ipfs-core":"^0.9.2-rc.3+6adc3fa1","ipfs-message-port-server":"^0.8.2-rc.3+6adc3fa1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6adc3fa18f1dedea22babce41d24d7435e497ecc","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.3","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-YcGpNxKmnoMKPoYIamo5vk818fTUiFROix39C8hP/zMfN+5s9Z+FAlqMY+oMPLvKoSFB5xqWNLvhwwztxzdbjg==","shasum":"ab4d6616f7c9a35b66bf9c704f23dc77c5753580","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.3.tgz","fileCount":36,"unpackedSize":155077,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhC9AICRA9TVsSAnZWagAAeNoP/0DAbU0cw7uqYjsWdWFc\n08ZmaFgIV3U40pq8zGyPhF/VN7c30WEmPfvEfiVPyFuuKFppQhJFK1fGdZM6\niCyOTjLEDX5sigK6EC72E7uP5AnfZG2UoluQ2U2FK5gll8jUt/6NCzwvi1KG\n94JrgtSFfpNFqp79TL9mtkeJ3F2ejzf0ZYltQabNbP8bmg6SgigFIOja7bOV\nf2W5p7jI9FdIoCReyMlL9TlotsSrli3PUOgQtBUj6XnXdNajwXKLBZt6DI+e\nVIkJAJuPRcLyG+TgpRmcHAAORD3AGm821qSniWN+u8fjwYXROwd8xvJXzame\nrXLj8fj5hzWnALy0zFS8kUL0XlzwHNuPMaVdXzRwX1jPS8cSTYg9e2sItxHE\nPkykYv8zyKa+o4bKN2aQ4daeQpcn5sIxeJPNrIPM95vL4aao81vaplhzlnpd\nw9K4i7QcjOEEWMg4ars/sjGlb1kBkV5JV7vyjm1n8Cu58ifA3reOETFkTqWo\nYg+8YfLdB3T3xSG+UCAvf6JXhpsEItA6xPHiMjix5EBfa7NOb1KNMobMFygH\noMETGADHqMtA8rIXdhdqiUE6YmTgnI6YhF355A/A1TB6FSXUL9CUelwGJVBY\n+2ZZe1nZmRSG5qTciAcMpYBODpvAgFMkVQEheWKA+YoS9bcqmXZfZYQ3b7Im\nVEUe\r\n=TYiS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSu3vxVMbJwJt+rRj9s6nOnryjICnd7aWoZPSXzgZNmAIhAK46bg7/9pktdo/TYaYaJrcCGpNUxDuX9BM1qrb2s/xv"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.3_1628164104562_0.10013325998837952"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.6":{"name":"ipfs-message-port-client","version":"0.7.2-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.6+a6c68803","ipfs-message-port-protocol":"^0.8.2-rc.6+a6c68803","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.15+a6c68803","ipfs-core":"^0.9.2-rc.6+a6c68803","ipfs-message-port-server":"^0.8.2-rc.6+a6c68803","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"a6c68803ca19536c022c72554af2311962b2a063","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.6","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-O0SGg8GI1BYSjyMm/dNthvBpl2W+hRwMnICgnOdtpamvHROIJAAiAnMS8kQd8z7UIvXqm8PSJS75bzLW0jjZnA==","shasum":"32f64d6a85c127250184f18e50885bbe863d2407","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.6.tgz","fileCount":36,"unpackedSize":155066,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEVinCRA9TVsSAnZWagAAC/oP/0jeq8NGg6thyoYhduyg\ntMiUR3YsJMtgQuxI/ERuJf37cESycOAQScNzNrGo3VlxcBtivNvsir3GVjmN\nI7hqcYha7i3KLEjFXOWVSerBPMW2jDFhiF4eVRNZTdoAtiolGe3EuvxnE7gq\n3CedtCEjbCoLrhs1Y6f+qUU/MepcvXklRP78hlXWIW+rlaOBWX4sR/ieSDF7\n7qeXyclEkReOdn+v5uvuSxy2OjICZSS8XrKFtLnJ3DOZBeN6yu0lFEZeEDvv\n5IETP2pW84l5AJmkPSh/htqmE9PxaUqM3YOTXmdNoT/FArlgLlTNYl7Qv0xc\ngwjkLKZZHbLhMsj9UE+BaC4xX8Pd+JxMy7h4V2pWHpMEfKXg/seJwNVqVJ1z\nloJ29BXSo124z8V3vxSIqWEM03GRD7Yepn8HL1eZyV6vFRsUFHhSyjK2bs/5\n7mi5Qh3IF5QVMND6UY8Wbvt0WPNO2mP4t1KPrD9DD1/v3qNS8UMTTn+TL+sx\nJ0hg+VNmGvnL1aJDw5AnafBDnL9WuafXd+8HlPjTVV8j1AAO1obKI/7bscoB\nzKdW+9D5pBc0CLZSST8v/AiQ/2yy05J3KSCNLqOnFTcK0kkzwHPGdvoFJyLE\nBV+xTby3RguF3sgY4/UPRAnim0/F/1rF6l+k6H3R7NkG/JID7R6+PqRU77xb\nB692\r\n=7bWK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEoSranC4RAUBVjynvPhcXXr6BNVvdYkA3geVtAPollTAiBXWSZEhAOVIZmcnwuP2R+KCUWoSQv1QRRJBj5LciozLg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.6_1628526759119_0.8175748247803283"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.8":{"name":"ipfs-message-port-client","version":"0.7.2-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.8+213f0b2d","ipfs-message-port-protocol":"^0.8.2-rc.8+213f0b2d","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.17+213f0b2d","ipfs-core":"^0.9.2-rc.8+213f0b2d","ipfs-message-port-server":"^0.8.2-rc.8+213f0b2d","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"213f0b2df0e407dbb97ac2de9b82830da234fbb0","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.8","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-Nk+ePKYICZQlGcejS+BR616tuaEHhAZbVoIJEbhHpa5SMeDkUfG8l6xKsQooX79prJgw68BNJxymqBnC/o3prQ==","shasum":"1d36c11a5b61d1c174d5a01000bfa2f7b4e2d335","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.8.tgz","fileCount":36,"unpackedSize":155066,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEiiJCRA9TVsSAnZWagAAiVQP/39OKAB2Uh7cQJOqeCX6\np514tJThCB7kd22dK5UhN/N8WQQVivvjYg3lu3W5ZrqWYrcVeX9/Ho3ozJMj\nfRsdNkIy9kszKdryzpRuEZiFR529rVJaeXNIdL0zTOyQi7m7M0VwtipndcMD\n7zLSzVuVdX/IbUl80D3dVLO05vxbIMeD+kE1eLgJMfYcxBvEpOZ39SLKItJE\n/L7lu6VTXuHw3vPc4yvZGIUIbaTdgKzSskSaAtAeQ8hdFcUHpS1UqobV9xWI\nHFKyPlLPRCYZx0ZCqPKiiOrzDr3rO35JZb7u/27MYj11sAEUK+2bMlD8KHg3\n9z3hyJPdtVVAVX8Nli2YG1zQRo099HuG27bhEnEwcjbyzgiG6AV/kZxh8qTV\n1wrQ6853qg2yTJycLysaKQ7avd40Hg+yD1qhfXug8JJzMJ3r2LtnzSwazvWS\np60XLN3URlvnEu1BsTCcEz7kx5+1zUBq3JxCsx/BowzPK4UBgTkYziiyXNmn\nw4TEk9/6pCQsNuLUV1aKKpk3T8i0hLr2xntgI+FvMbgrRr5iv8De21CPxBHn\n0Ph0yIlHFza/bBDoipEPlrpRknBNnzS22upuI62oFPVrwCxEUfSyPOPM9ruO\nQsefKt1aa9xJdvMq8H10VoiqpiC3jzJzfhl5dLhvrIgRh/n8ZwKPaV6wkKUB\nXZx6\r\n=PWXf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUI/c3AdGDALkAK6BTcKMRkRu6h+QgDpPQnXRQY+eemgIhAPoI/wJqNKV/COZ0w3cb6K3FwQcNqRsj2ELRHspkO872"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.8_1628579977269_0.873225318705183"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.10":{"name":"ipfs-message-port-client","version":"0.7.2-rc.10","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.10+4150d1e7","ipfs-message-port-protocol":"^0.8.2-rc.10+4150d1e7","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.19+4150d1e7","ipfs-core":"^0.9.2-rc.10+4150d1e7","ipfs-message-port-server":"^0.8.2-rc.10+4150d1e7","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"4150d1e736c15863ae7e354fd1f7d6d4e34e4452","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.10","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-jXW2PQTFE3ta4qellbe24VMud3PDzTOXiOMeT5tg8gMeDbEK23tYKw2atc5lxXQXdHmuJt98vhKeS1xKveDhzg==","shasum":"e87183302f8d4472179d0d2cab1924cd68a6e00f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.10.tgz","fileCount":36,"unpackedSize":155071,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEkJpCRA9TVsSAnZWagAAwiQP/As/msdFJW0SL7M00nkG\n2TV1GLxL8QsJ+3owXgwRcXroRlght+fBjbJdAtismS2NEitAW6oLDc0D/3lO\ncCae8NcYEODvadHgspYB6n1CS0a17Qy74OkVG7yhgqmkCf/pmMdH/P5FadN+\nDWtiQvMFjGTx+RVgLJRGpr9hqMDbQ8BRJjklBi+zfhZWxalJNhODpLDpm93h\np85gpsxEx4uMAQ3ORv5gU9lySOeq2+LSEuMikt7YqPXoO+kFNW6Utc8P4mn+\n6CxJtvW+2MwyxcpdbUSlq6LbEP+IDHhEhpDyDGIq5DF4DSv7+nwH49XfkPG5\nTK4Kvh4NmYBnJvY/oigHwlQQFkF5UX71nrh7bQpUuA19s1EXbq7pyNGP9V6P\nOSdTFB1ODmPMuMONz+wF3z2k9UhKaA0s3HihTAM1UmdiSItCvg+DEDGAxrCn\nttnF55Rk8GKQODBR3OB4KQBIlSGC+ILrfDLlY78UtDT/OVoDMgwdAUJ0qKQJ\n2et/Tkay3gDHC8PztjPgNB2Xnb00qD7fhZrXY+pXz2NseUN6dh8smtJ8EHWv\nnP+eUH4UOgLY1sa0cknGsdHW+WOWxaXBHq7tZc7XzBexCtT7REM8OJQ+BDk1\ntsfDQ9IiQiv99JUxZksnWn9rnXGpeG7p4hRnjibH+gdo2fas9uNi4QxJK+0h\nO3KQ\r\n=cqmK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbc/YJxaVtZv2BKVhrajhlK5haR7fnJtQI+CDYtMLJ4QIgfbQ8ckJdDH0vXEuDEbXhzMp8ocUnzGSn5aNjN7Z2I7o="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.10_1628586601242_0.43830433552585757"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2-rc.11":{"name":"ipfs-message-port-client","version":"0.7.2-rc.11","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.2-rc.11+fae59868","ipfs-message-port-protocol":"^0.8.2-rc.11+fae59868","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.1-rc.20+fae59868","ipfs-core":"^0.9.2-rc.11+fae59868","ipfs-message-port-server":"^0.8.2-rc.11+fae59868","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"fae598689a0b9a3bdcf80ac71c19b709294f2932","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.7.2-rc.11","_nodeVersion":"14.17.4","_npmVersion":"lerna/3.22.1/node@v14.17.4+x64 (linux)","dist":{"integrity":"sha512-l2yJEYv5V4w0xfvksw7p7UcHV7z8nlCXNdtwk3wzvHYTiJefTu7Vu57Sv8He4A/A/odHLaQuULeS8T3NNcAB1g==","shasum":"1b35bd800f50030f2d075a67e0ffe02c60356ac4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2-rc.11.tgz","fileCount":36,"unpackedSize":155071,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhE5byCRA9TVsSAnZWagAAI9wP/Rz7pIasIX+Bl6F2vLqT\n3wkswupprId4BLUmJUksbbJ8JZOHKoK5T4PXDwrNv2rJ652KrRx6gmggUPcT\npEF4yJOiKLZzALTmIQRE+GNuRbwmStF9x9OiBTFNlQHufQJDlQ2/hwrI8tQu\nzO5GBifX19EZqmLXu2gC9pTN1+TWe26B+wUfacwV5cyUdOUiv1zVcTTl2OLA\nkuuF9eHo9nBaJi16gtmdd8vh07XgDe3ygIBJDyn4F/vvxp5zds1hwxzDEbKi\nHM5Lt7OY1y8gx/pip/uv6Q+OSl/wt8YfsY3j/KXpwyWjidoFaybv1chsqBwr\nwLNeUKFjHIelvzsLZ0lrF1yC6GdpG2OCJ7D03So7crzHmJir092iWVcfWpqC\nSVoLRX+TKSKvDyHDVCanM5HiaJuRZ70xwy8KCri7SzBJ38Q774vVkynjkMQn\nTHwKFVHrVkVNCcsIirZp0uuoHgSQv1HaUMwHCeIJjg2E5zFuO4NwwiNlsbdU\nKJTkmXqvB2TcigIzyGDXbK30HVrvquLXOFQ///1D2K5qTimLiaqsbOZ9kn8+\ne5nBpHnJgHhNBm8wdK4d5juE7ILBHYvxn5T+h4TgiMfruZsRnXdIhx2/hhqk\nD6X8OD401CbrIDhAllwqSQD7ZJ4QBg1jQ1EyNXJ8tQ2SPE50q/L08KZNhhVI\nphCK\r\n=wcas\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmecjUSfuaJcPbldOXZnTrErF9dg1GqvhYVzrk9kHILwIgIvb7Z12WTGAzjp6XmIMgViuBlMZGhXW+tY4k04FfTqg="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2-rc.11_1628673778145_0.05016928549931854"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.0":{"name":"ipfs-message-port-client","version":"0.8.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.0","ipfs-message-port-protocol":"^0.9.0","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.0","ipfs-core":"^0.10.0","ipfs-message-port-server":"^0.9.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7f241319856719f2d9f2c1fc4a6b1062ed1ad398","_id":"ipfs-message-port-client@0.8.0","_nodeVersion":"14.16.0","_npmVersion":"lerna/3.22.1/node@v14.16.0+x64 (darwin)","dist":{"integrity":"sha512-ThoZQrVALMmshwtjIVUsVPOOpC0tuVAY9JewEmGsO42SrpLuTD642wEvBfKGMTgzpmS+hXpmPSmo2jvSX0ZgiQ==","shasum":"898aa6b67e05c25f254986b05f297c6ed0219cdc","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.0.tgz","fileCount":36,"unpackedSize":155476,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhE+i4CRA9TVsSAnZWagAASOYP/0lNjKuYCtXq0JkZ2Qt5\nm1rsBkVQezGnCQ4NDyMwKyDJsEZlWCAB+y+CrXIqzD9yEWPHs2V/jhUULFCB\nScbnPgpIHN/O7XPAdAfPFbfgCbMUqRDk/hoVfbytaB/RMDkOuc4TyHE2F/mC\nq6Cpe2p10HukRRuGVVtMA7qcaTq4zSYhuZTR3CPvm2FvMPOfxGPYiQa0Uugt\ncmlePFeivs9Tb5zLaRfa2KU55kV/v7AxJVA+WdsLFq17H0Zzz/gfxd+rKK7g\nNLFtCJ6ARsAbQdOvfPLp6DTBL4snmMx9gvVx+y1PPDuxdedWLQF+borp8wy7\nXduFhGQWKQ+Weiowp7zyrO5CEdSClQvtTZNnk7yzLyXMQO6uHstX/KElSot3\noxFrJfEQA+QbS6fTMDuanR0YA3Ii3SMSM2O3APjkeyIAodxZg9TO6szQW4An\nAJjE1nyI5K/8wYgrTV52ALeABcqlvfClt7Qo3YOGWoRPMkYI/wNEh9SAhXJA\n/DJ9sUSe6Ii0hXrxvnoy8UfASXA4OTBhRR49oFKDNoj9BeEgOttOuHRk8nWB\nGDASy1oSAMsRnQA9acv9KIzdCO3Ylp/RuFl7uoaUUCRM//KjlYqsa7Eo4CDt\nDuYQC3CHFELF9H7RVAW0Rv0vBaYXvA+kYbfQc3uP3Q/x2GLFKIrKOi5KqfPX\n+xp6\r\n=l6f2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAODPjyiFcKgTbDGTc+lZrP1/fSbuhey31tpADhU2yIYAiBGpbRWlz0soe39Ienyi82howAsqTjjJLy/UhpQC2s5Yw=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.0_1628694712211_0.16660907051979335"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1-rc.4":{"name":"ipfs-message-port-client","version":"0.8.1-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.4+b7735674","ipfs-message-port-protocol":"^0.9.1-rc.4+b7735674","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.1-rc.4+b7735674","ipfs-core":"^0.10.1-rc.4+b7735674","ipfs-message-port-server":"^0.9.1-rc.4+b7735674","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b77356741ac597f57e0b9ed57cddcf0ce3fe7806","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.1-rc.4","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-UmmyXhusLC71bvJ6axu/w1x69rWcxbI1H040sbAc7ZpGz0o974g0dXW7tCoq9BB1KtVVfqxvVzYWqIjHOzSBTg==","shasum":"39367361ec63c37c1ac917dcf809c202feaf71fd","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1-rc.4.tgz","fileCount":36,"unpackedSize":155560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFP0hCRA9TVsSAnZWagAApL8P/i3cYX/x6rsX0BL8pk1T\nM/zoVebiciKTLHWIYepBfVOfvZQ2lT/Je/s9KJ2VEd8eY83UPCFU7WHWtO1r\nMEQUdb2GDHdehu8kLI6PhAnfCBUsHaMiCeIppjj9sbcF0+hiNzyk5/+I13J4\nmSgp0sT9Mh15MyYTmdwwfeFmbcRgjEeDdJRVLSCem3j8pbFE9AxG91E2GFf+\nQhsc34KsjoCtwrdVujoVkCyR4pwewAVTm+0cg3H3AaI/0XRoIXPXtQA36uDF\nRnXodnkmGeRNTgtEln97keSXqMP2/mJg9C/WECvJbKkCaB5eAFDx1jq6APa1\nv/zaW5iU9VmJH6ae9p42vPD1XOGWRme6/XqjI9kTkOdzsw+KSqArgWjum/PK\n3oN02m5WIW9D7fkfXAgZG4hK4D2rOQquVgFVfXktHZ6PGfX2bJUzJPRKRvMY\nhoC3c9YNToMYMcg/6h1Rcuve0ritObzQVc2wgYlD6kfOO+PUgoBoPp9Fo4No\nPh2wAPBu/rgI5yFeAa8OdXBk/VhrE3BpR+NBSEDS+BOzcZlnZ6UDa+e+K1sR\nGzob5AC56ZJiEHKYDcb70w/d6FS8oyLE8wbScqbAyItiHFnmtlqudvpRye3o\nEk+jbp8GKfIQ7/1yx2p9hiZ4cdU6ykztyQtArElwAo5dAglirtZudeSs3Tlg\n6iNd\r\n=j1wF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCDSMgTYCdgoPPoVXq6GecrpA+Y/s/ciK5y3naeAxb+YQIgUwqcQtqKUW2wFxOV9n/pTDhupB16AAS7p5Mrx/TZU7c="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1-rc.4_1628765473210_0.08591727250223302"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1-rc.5":{"name":"ipfs-message-port-client","version":"0.8.1-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.5+55dfd937","ipfs-message-port-protocol":"^0.9.1-rc.5+55dfd937","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.1-rc.5+55dfd937","ipfs-core":"^0.10.1-rc.5+55dfd937","ipfs-message-port-server":"^0.9.1-rc.5+55dfd937","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"55dfd937e4175e049287b9093ed9a52bcf085711","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.1-rc.5","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-TBmwl3XBeRmwdLC+wS5RN1Ar1iW23efJ6+872g3TQQMXkHZx6hhX8gteMJubw5tUIi48xGi2Yu044WNVhIk/JA==","shasum":"e637b1464a5128f58de306c29850f065842a8924","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1-rc.5.tgz","fileCount":36,"unpackedSize":155560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFQDsCRA9TVsSAnZWagAAbqQP/3cObJ0cBnUlUTXSPFGq\naoV710qW8UoOJJ8b17s7wi2ZRJ+G56ofioD1o7zRC8S9z7RkhRwEOb5xl4vA\nJK+VYXEqRHh1mc+ic+mnWSsm4olnjKT3ueeO2qdEBIMZMMjJRJTjlTgruRDI\n0GgkSJCBi6XTdU0svN3P4Mt++1vW51p/acsdmEYU6rby/o3gMarFoPjUHkwh\nKrdPQhn6B+EWq9jD0rdChUSxofS+laHhRTf9T1QAHP5lT00P0kHY5UY7b8R1\npzT7Z3DAbOMn8YBuQJumWlQvzE8blddxVG1EIP/0cb93I62tWJvGaEOQQU/J\nDLeQza1M8ZPndhvTIqzyln/Jlp0lSq9e5+USWhrxeVB+o3Ryaed1e6YjN6py\nIxZL2G+xcQeW2o2Eb3y00LmOxrZK2OiV2sFskxjCh9VdDN72+R6S8mV1bxWz\nAuC0njzXcrSgXuGdU8Khp5yq4RZ54F2x696ILdMZkafsZ7WjnDsymxAzH/KF\n8X5KyUXiNAe27IA7MhxwVdYNKZFJboX8GzxyzCjXatxbnafRv8OiLW9Qc5NG\ncEjeZJ/Ho4k1xtd9gI3+4R2ZL4YO8o1myDXe1eJajrnmIhu2F9s6HftYNXF7\n4r+FjzbN7u1yL2yNoHhLGMs2qxmAEuraTScWegPBKbfvKH6HB1K4myX0cNDP\nY0lw\r\n=LGsr\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFAD9g15HMcOKQJaQsYpYIDla6ZD5Eo9f/wwrHoudhAOAiEAgJFajy5cB3X5X5yA4EdIXYsTtsNNxS+ZV+naSuIm1Ec="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1-rc.5_1628766444643_0.847048026806096"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1-rc.6":{"name":"ipfs-message-port-client","version":"0.8.1-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.6+9eb29106","ipfs-message-port-protocol":"^0.9.1-rc.6+9eb29106","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.1-rc.6+9eb29106","ipfs-core":"^0.10.1-rc.6+9eb29106","ipfs-message-port-server":"^0.9.1-rc.6+9eb29106","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"9eb29106c07253d50121a5be1aaceaf62b022742","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.1-rc.6","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-5fIOjEr/p27b2JGVHYLk9RfepRSZhIxO0xo+4LouW6jMY9xKCA7CrR5nIEv90nXerrnuW/6/578JPuEEVIRUdQ==","shasum":"7de2ff63ba1cdf582b2f9af84690a93fa1c4149d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1-rc.6.tgz","fileCount":36,"unpackedSize":155560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhFSv1CRA9TVsSAnZWagAAyDkP/jHxoHS8MMDD3CyZNccy\nH6nDqowas7uCAfx9FaebDE0308Y1Qznv//2CcCjjUziZpaAXaYxmP1UDG+Kt\nHwfRGXTwF+r7jdd4+gU+mvPDj5QvjLsX0B9DLwGBc/kjTTP/GSiQahlYAmmG\n4smCEY1Sn/Qa6hVlQShF7sG4YKuX3lccOMK+2vIY8fuTyCFgUQWKaH+kz5qp\nOlTEjz1iSLv3AcMP/GaQ3LY5snSg3KfuXGYByIu6Sv9e+4r908VSHv2gS2yJ\nMZ9k5Ciro7/2ljhMqQ3QznQUhBfgdhS2Lc7RRQUW+HpDsSWo78+b4EwW5s3g\nisQM0ovN5ehNOck9ldMh+WcpnI63eSpvoaDxc01dT3q+lItUahXhBFrIYZVD\nHPrV2FY2s/seujU97RXmRqv3dz9Ja5k/Rk+DP+cDQ7nxGDSaT5qg2yVZ2crh\na9q5xnAidcNdpcsEpWSX1oYhAgX3wrvxme3q4z+gW5YYpAwChj57StMp4MZy\nDrEMbelH5in7iF+VADN0b7QYfpyEL5Gx+B1w8a51DgNMBZPx+KtTHe1Shyio\n6YvIoNX3baIaZoxqLqrkLNdhgKrzYmh3oL36r4Jn71odVDZ7jDIKjK5GF7kE\nSqA4u9jUy+KYQavNmwhQE3qUl55kRMcmpE1TnUKlkVhySIf5GyJJt3Q+gNWH\n+0LT\r\n=BcnF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGdbuug5rHYT4U2+yy6sBLCL3g+RoXqGLi3vjXIsbtYnAiBFqOWNCVmo01SAZnCVgIT0XsqKjPlpVI0NtqAGP/zgdg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1-rc.6_1628777461788_0.41579834610563693"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1-rc.7":{"name":"ipfs-message-port-client","version":"0.8.1-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.7+1fa4e8d3","ipfs-message-port-protocol":"^0.9.1-rc.7+1fa4e8d3","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.1-rc.7+1fa4e8d3","ipfs-core":"^0.10.1-rc.7+1fa4e8d3","ipfs-message-port-server":"^0.9.1-rc.7+1fa4e8d3","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"1fa4e8d34f47d1d6273b6d82801d324dcbc6cb61","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.1-rc.7","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-RHGb+/mMjTiwLh7BoGbItXtM47QQeEzFhmvT9ct3xGejqTZSsd/Fo9JC5vbgkgv/V2yW5E1h1Rfg+nCuK0TSSQ==","shasum":"0062a93ed9e36ac3bb3e4cc27a9f7e086253d8da","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1-rc.7.tgz","fileCount":36,"unpackedSize":155560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhGoiRCRA9TVsSAnZWagAAtMsQAIqeNQFX4d1Y9PLiGMix\n49kE7GM2Ly0GLvtYrYR4C/eBoz17iRDH9fcs9Ir0a8oNXb0CIsK+8Y+N1c29\n+7/OpRDY5yNnFwstcD7T1DtIjnXiIIt9lqTqy4G9bXE/FqEHZGyC0VJBrMQo\nIHP0K7+qmKCNZ6agmaDpziX7gnT0cFvTHZn1bJ9xiMgQ/9cdpTkS9COIpAtf\nCfvbo4meQVrOwsAv02N6w4luNzbrGaVGBliButR1iyuLDqTuHi4v4g+hY4kh\nJlaMv5Xpn3VSlaKCSkdrVcjQC1yrypELSANFyYlLDItjRYl32o8VXSs1yQle\nQiU9OLO0khiiDhCRkwd82Dedjs7nslV9cSOK2hTYClnHZ4DQrsden++EcG4Q\nHXGpVEf93sH0aWme6uKjGuc9B3d/HDnFsmFO9fMY9ibgVQm7IBQfH/7cBV0K\nuPC5Ks8K5uGjiscIyG9NqNisb9Of79iNb3zCbb7KUr/YzzQGJrmw8eu+szXq\ns+NuX8I6v997jr02Tb1isJ+GqaoZnacL5pPDZ77I4L688VVOh/NyBcTnjJHC\nLdiEu0uw6ZO5bVBX5+fGgQejmD7i4Bq3dcmkyMpf4wWIzhvkiFN8V/2K4sP5\n1cb+2ski9/Yz7VhvHV0yzRz2IVKw3NHovbDPrnQCbriM2EXaXZrkyW3Kg5Ja\nuHGW\r\n=hci2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkfgmHGP7H/4MZU6FZETW4st7TqCQFK/2p5m5cwjvSzgIhAIYzweg9SyYjCVfpl/mvbQ/laIc128l7ZHkdM+g/ZNYk"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1-rc.7_1629128849023_0.950220802187606"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1":{"name":"ipfs-message-port-client","version":"0.8.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.0","ipfs-message-port-protocol":"^0.9.0","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.0","ipfs-core":"^0.10.1","ipfs-message-port-server":"^0.9.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"f9099fd0b24c0f474f5a9a3309c16adad5574b83","_id":"ipfs-message-port-client@0.8.1","_nodeVersion":"16.6.1","_npmVersion":"lerna/3.22.1/node@v16.6.1+x64 (darwin)","dist":{"integrity":"sha512-FcTE+gs/Mh6buJHuxt0EKk9Qpdh74AGGfgATdPQTWGf9aGwygAULXmcsniCIX6EgFtXuMLSpzP2gjAz6pwawkw==","shasum":"9cce43dbcad07a557d501cc6145279dd79eed9fd","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1.tgz","fileCount":36,"unpackedSize":155676,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG5KbCRA9TVsSAnZWagAALeUP/0nw8NRiBoOjRWrfoWeU\nLcCNTaBX0X4JIS02yPstuR90vb6uFvJQUz5KMDPZMdD8M1fJbMb3ig0zUVq5\nqzIYTh4AzDLEZXw9tuxp25Wl1jwgAaG+bEkgW25YsdYnR4h8Lra8YESwNPoq\nKE9FnNKQf/4PiLHn2sK8trugYWIdnyC9J1lbuQtOUj36Vsz6qDqJsuu+xR7I\nV+RP+97IJ2ZEKL7MuR0+myvKxINYbItRgv9jVDAP7OHl6zSG6I6gtW1hcWUk\nTeaOVnM7O+zArT/BM6+khF1zUwv8YjWs2ajhfVKxKcuQwSiD+J0zh/N/qzIP\n+VUtiCLv64d5kLF8ZL6ZGg9yaIZZruiDeO5CpbhxQ07iy0CAwgj0zL5fWMK/\nRasvI0jMBnTNy8LkrHidsDFV4VTg66j/4uyTI9Ufs70ScHOq/H6gus5aUEDy\nPySXVljQqLxDFMu8ZC6691PT5OmjrhhUnhwKa5ZFkF87F27tOzzkljW6lEaj\npmuC0yWwQ3MogH+fcNinQg4P9by1boUkDCECWyQFZxaTYNfQ3XfftmiRZtnb\nEQbANClR0xuOvkqVkA0vTm0lYWhUskXEtGcYgGwBuNxRtiLr5r/gVH2tuWq+\nWZqZeH7wngl1mJ0VJnmI+kuHiJBqq713Tpq8TH8eyeLyaWSfFy+2FwjRUq2D\nmqVX\r\n=bwU0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmn2bUYZQ6vAaLdIr5qNvahMXW9n4N121u6Gt6g36t9wIhAI/dpNdBuY1kxtYfWy+jrdSXbmvfpOLDGCyZCiWEbB+J"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1_1629196955208_0.5423480451868345"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1-rc.9":{"name":"ipfs-message-port-client","version":"0.8.1-rc.9","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.9+c1375617","ipfs-message-port-protocol":"^0.9.1-rc.9+c1375617","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.1-rc.9+c1375617","ipfs-core":"^0.10.1-rc.9+c1375617","ipfs-message-port-server":"^0.9.1-rc.9+c1375617","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"c1375617b6d7137e098375134097d61edf316ffa","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.1-rc.9","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-3xRBHbDRUrk2aY3DSc0F01wUbxzIzHHR652Q3ihjm+2PqGK5ADL1wVp+F898ci/1hLr0R8Wru1HaeMQlcvs+yw==","shasum":"f88f78be465b4fca9553c820f1c98e61ee803a42","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1-rc.9.tgz","fileCount":36,"unpackedSize":155560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG5TlCRA9TVsSAnZWagAA70AQAJTE2Qmi+S0ZuABBcHRW\nFDhNEK9M50uHsOq9U+smtf9eo77DzZeC0b966DaQs0P8fsZcme6F33+6tlSY\ncQxWGpwqxnF5w8B540ib5me5qoOf660POHPzhueb0pGvdnozfTap3tSCJZhg\n40J/RMBHiyQW+LfvvyFH/njKBZ3XA9AqBC2AVhQUXB1/oRQIHYWmAudnc6y1\n08TSr0RFnm5u9eAHVwPYB2ItAhasAmhK3IwzYhfArcpfQSHQ/LeBZxm6keb3\nRTJFkczGrbBjz939HWsxb40xiL9I1slZPaL1AP3TDimarqOPofsX3Is+713O\nWTDfL921kGaH3c+M6+kSk92Pa/dlRqXQD985V4UKTOk3i4GRh8wJFxdI4nA4\nSX82FdbM01rlLJXxjTehL+Yte5CmYLv7rkgJnh+c7grVRQAcXzZZr5oDeHxB\nbbyeeKgUIwiHMVeyo2HRB2MdqB/X6csGjKfvP+5is2Q/pK38AN3PsOOOM+Xf\nP7I3WOYztdjMuF1mC5YmBYwDRmaXjDNxnptk8AlYx2G+1Tlp+QFKY0ElaQ92\nCDpNs9SAv3b2n4uy/6D2dVzpwOFSs5U7m67V3SIe7ubC3Wfp5p3nMXGoCJVK\nz7kdcykMGipzYOBOMrTSwHRabhBmogKpkV7OmDhicubGw9wU/h3W8PilvUCF\naH4A\r\n=jP4X\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAQZopwOJKEJImAO/Y/NSO4X65ARbg6pQi7Wu2jQsGpqAiEA8FV8SOcwgJjd0CjMLVj3LX4UYCct4EmNUSOnVGBvh1A="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1-rc.9_1629197541826_0.9921469071027902"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.1-rc.10":{"name":"ipfs-message-port-client","version":"0.8.1-rc.10","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.10+2c1a23af","ipfs-message-port-protocol":"^0.9.1-rc.10+2c1a23af","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.1-rc.10+2c1a23af","ipfs-core":"^0.10.1-rc.10+2c1a23af","ipfs-message-port-server":"^0.9.1-rc.10+2c1a23af","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"2c1a23af193a23c4a710a9007c7c22b4b729c7b3","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.1-rc.10","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-Jyh61VE3xFvIMwbqeB+Q1LPAKVN8B7DodIcwPc6fsnNWvGd5qRVU0O00nJxRPrWB0W8XYCLL6HbkHtnppyM5VA==","shasum":"1f91627b271c7e89f5356c279215d17a785cc22b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.1-rc.10.tgz","fileCount":36,"unpackedSize":155566,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG5j7CRA9TVsSAnZWagAAQoAP/30HsKuuYPB59BT68DCk\nxDLvjRtwAe9Vm5rKncbTvW88pfhIk3sHLv0X6vDY+uiR+X8sqOg9yfA4aCQp\nfzOe3OlC8uWy17uFEJcwtj17FkVVt3RfzxoMzwRONGvJCDivLnNfTH3Gwg2X\nmzznLwa6t701hCSwF59bXI5FUZ3v+qZZtzJftJMBnsOLj0T+/L/H1nNPVGwD\nn0fhpxtNIb1W1hlnN8FfHqP9KNOVpmVnP8f+ogzPO5UhjcMJZq/0WUZ7KPeh\nW2x0ivaOehu2f2I9PuuRpBvUi2vrP4qN2W7KY2U/4o90v0jwmZSuBdysj30t\nZerGm44tRaPRGRbvVZnH5x3o5QuXqCaurHWS+AOREIbuxnQydHXWO3CzzEvK\n5kUTDWAO8251nm50VFDTk63gS7axHgG/ewblpCe6qvYb4LiX6pi1F3eUk6+z\nw8v5EyHBgicV9MlvdGJXj5Jx+jyYvI0nQ/DW/qYM9eDQFl1+KlNJJELmhFxB\nwvsdNFDowokfNH6RjLx2RZ2koL+GyCXhS8P9mUuMaWwuRCiUh/9/GOCDxLOP\nFIj2eYvT03/hyP4XMiy11OM9QxIumizmAbGlbJbeReYqrGj6HnfWlPItU32W\nCokMu70NluN+Ikv30FSvw5FRYFay+dtji9VMNBDMvSnKB3dYc0dBTWEUbnlF\nU76A\r\n=KJki\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE8xPZPhqH85fyIuSKDquVI8Aq7tNi5qBRLu05xA6kNlAiBsvaOV7QeQOlFLBplfbqaX3aQENnaQzEOKiRG6YjmKHw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.1-rc.10_1629198587534_0.23146212517339637"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.2-rc.1":{"name":"ipfs-message-port-client","version":"0.8.2-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.12+438110ca","ipfs-message-port-protocol":"^0.9.1-rc.12+438110ca","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.1-rc.1+438110ca","ipfs-core":"^0.10.2-rc.1+438110ca","ipfs-message-port-server":"^0.9.1-rc.12+438110ca","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"438110ca4bce91dc771eafd9d6589573801b16aa","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.2-rc.1","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-mJVxnRHz7LvhM+Oq7zRxMahbdDXhXsUCBU6y2hEiMUcmHExmtcCMGGEFbWgdtMhcEXxkFAwNxkNnb536Sxciww==","shasum":"c6f06e96e764e21bf52ae09b32754a8bfb82e520","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.2-rc.1.tgz","fileCount":36,"unpackedSize":155763,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG7HsCRA9TVsSAnZWagAAaKsP/1IZ8ADeV0hcucQnIS2g\nOnOJPYOPCp7+1mITZ6qGkesmxVUIW61qa84HCsK5PutgdUREVGjDX2Kh/g79\n2m9Tad8NjVRUXwAfjJHMqtqbC66Qsa/O/7HsZlLjnr35InC9citXVk8vdqMh\nHMYIp7KO7n+6K1OSuLD4m5qM7bnxZErdBfW9qAbHFCdk0a2LnGnTZCOMIRPa\n1n+lWnoQPGsv1FZ/vkRspLRPf0V1O4Wd7uwfIF246InCKM1lpLdXumpylxIr\nt/7+p5JksFW3OUndE20iYyJ5Lslz9H7/pfD4+32/fqNWpG8KrkwTvZ58/1i4\nQCCcfR8JOYsgg3xs552LtvuW2wW9bGZqIw3+Q3Skh9cRFvupmU4SpaBXFFC3\nOIlJBMKE+MLJtLwl0k2hORgJMxBtd8kp/YHG3UTVdDKhtYGujpcR8Ml+8+0p\nTN07YcLZwxbPzPjONXAtlNkqL35CxFWInu+R1zwiEmcP8++vUIcO6GZT/NDo\njnsylsu4LIm9k1eM3WI/WQ3l6A72nZXVjhAu528fJ830oFWmEaY1YKUcOf1p\n7h95SzfFhrynHA+mmPHHzLVRGhZcMOr2ClcVUnGN2yq/Es+SKeg6f5GvsW4O\nBhNd3ANXvP2Ce8kCsFErWR8dzKbRbEfvzWEAvUPFxTHZ0mv5qydlKbUyD/b1\n/8OR\r\n=cBOx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXGaEPzLIFdvzEEGZmTZCiDvC4VpCElAnSOzb2ojfzaAIgTvaF0iQonXcmhFw56b3kr+V1EP7RttMoUITgChVihSE="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.2-rc.1_1629204972286_0.21290884442095703"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.7.2":{"name":"ipfs-message-port-client","version":"0.7.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.6.1","ipfs-message-port-protocol":"^0.8.1","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.148.0","ipfs-core":"^0.9.2","ipfs-message-port-server":"^0.8.1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"5d739b691addf328c2865e649db1c52a00d30711","_id":"ipfs-message-port-client@0.7.2","_nodeVersion":"16.6.1","_npmVersion":"lerna/3.22.1/node@v16.6.1+x64 (darwin)","dist":{"integrity":"sha512-8a5bOKrOYExkRCWcWeRfWbaZYsAEmIUhjzmCJIgt4p4QQZmLiFLIUOj7z39/skiTC6IL51zv0pjbLRsXqgYnVw==","shasum":"ed8acadeebe5e4649f9f466891ea00908d74c581","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.7.2.tgz","fileCount":36,"unpackedSize":155192,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG8M+CRA9TVsSAnZWagAAlrcP/141fZwrsR7a8MKVt9qa\nh8lSeKDeXrw1xlPcNGRp804nO+vikW3xeGjUPZAWdW7MxbqEXGrYWcccxJp0\nCpP71Cc9ZbbjNP+o33iojMd48EsmWp7U6bJeXX/YEJVLvjbFqT04W3IoOaKT\n6h+F4IXJJW/0I1npjA1Jc7BcXaku2L+lzV2M4IhH/TP4tpcGUeZyofkR17Sb\nO8Jt9RLIOkLmQzRxhDFHd/DuPJqg3SE2FaJAUc8yark8Z8ek4BPbtygkZNis\ntBq8jZmnViCzTh53dpSitURc1L8hQFA/OQycFVd03S8HMx8PCCiMXvH7NU9g\n+DXoOhypvsLvDJCh2rlHpIkTqa7ZfUz6cJgadCdTOdebuenhfpo3zLU0hehw\ngi0YDMPZKd07643CdVeR9q8U6BNWP6bxZOKx9evBUy+Nn/WJ3khsPzlc1cK1\nc9TeRMcK1hkK/y+Y2nZBqYAZ8nxn3c33x+ariV4Noid61RTRtK8ctcM5wJQA\nnrFc60MK9Z53KBukK7LZWTQzV4k/6/6RRtcu4+lTXYjy6++2/b8WaAjF66Jm\nBSY8ylV4eJJIRZoFWsCRImeTpTzXQptnPwnwGizKu8Wh4DaC3Y5DUw7eNzlp\ni77KJ3RLtP3TBFawEoIB1hXk/xeIXZce81sEbH3ObFnjdEwSSwpgBdXtYp0q\n0PrP\r\n=3Op3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDkJlORyG5IlD+8rYg2whmIVgknhiM3gIS9xYEyRJbWdAiEA+6fFpy7I883vxOGDRXUU7XHCI2cYYyBsupWDd5JL0zY="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.7.2_1629209406066_0.4536581098144745"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.2":{"name":"ipfs-message-port-client","version":"0.8.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.0","ipfs-message-port-protocol":"^0.9.0","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.149.0","ipfs-core":"^0.10.2","ipfs-message-port-server":"^0.9.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"ab52012d0367e121ac2787fcbf1ad6c928d28479","_id":"ipfs-message-port-client@0.8.2","_nodeVersion":"16.6.1","_npmVersion":"lerna/3.22.1/node@v16.6.1+x64 (darwin)","dist":{"integrity":"sha512-tGeGqiHEuw/XygMRPSmijJDwTaq6LYi/0VDHxQme9zrdpRNf2KCszs1eK+SyTX8ah8AlGmMkZge6Pi/jpJ92VQ==","shasum":"3295341fe5eecfd418416bb02c5b8e1bbe2f5255","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.2.tgz","fileCount":36,"unpackedSize":155876,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhG+9OCRA9TVsSAnZWagAAG58QAIWcknIisX1jng/89eJr\n0zeaqx+DfHkFQ15fDSRRrzeByGy7LEMV9U8XPSfp8kSDWv1DmrAbSN2nUGMU\nE+w9v2wpiGIyB9SNUUNcZEdjYY/povWuwqNS8oVA6YOQdp65DIInS1oVQ69u\npY2FguvvWT+cYcmHlEqePk05UYCmZpX2iwhTCrT/xCi2qoeV5DovoChzcHq8\nbqzXYu6EV5K98VZP88fypRul6iKYhKhOPyQSGZ/ARhDHcbd0C9BTn6Q4w/Yx\n6J8Ro3o9LJnBX5gQNKRqopHciZRj4z9Q2lfwkO/cn0yc8mO6udrHZ7FkT5MF\naO/NJLYAwPcSjml2M8XMPJ9z+BTUMK/1IcBp8Vy/XjYjrPH2Dp9F/bacxbvD\nI4+d/mH2BpRsiamlC28Tc0ZjREb+RQaq7XiW3j8MknRZ+XfQPz8GsAXn75zn\nVxfPl+J6qA5SxBldz825DSOfeu8A/g8D0EwuiQc1Pw3mFYdCi7b7nyyGbsUt\nLodVlbQW66MTXmiamMLE0yWgScCk+xP5ohzFcqGFeBVp/1ijPO9E6MriuH+j\ngU/FszUlGTeZGCeq50DMjIYc3A87oFfSaEezIAo8/66FRTycFTAVTkzUSTYy\njwuacq+mrg55mjrb0Zpd479Pm3yFhzaCQRJ0JR5hfalZ5hXshiF0Uj2v1P/Q\nCLjQ\r\n=nlCt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFEzl+acrK+O6+ytHCA7PYbRCKwppzcmvw0N/UbVieUFAiEAx2rn1qqtsPiUi2oMN3qPtINuOHFk2EYBiVvnMXGaLrE="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.2_1629220686312_0.7136379577802276"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.3":{"name":"ipfs-message-port-client","version":"0.8.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.0","ipfs-message-port-protocol":"^0.9.0","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.0","ipfs-core":"^0.10.3","ipfs-message-port-server":"^0.9.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"20e7c54247a7f6bdde374025a9ae4a23ee8df0d6","_id":"ipfs-message-port-client@0.8.3","_nodeVersion":"16.6.1","_npmVersion":"lerna/3.22.1/node@v16.6.1+x64 (darwin)","dist":{"integrity":"sha512-zUBedLuQo5/JrNO091CHq5TBKZlvgDa120j6Z9Ql1s0oErn9xc5f65/q3bBng3e0Yh5n3rrFjkTyGBNX5xpvgw==","shasum":"bbf22ff99add6659a3f681369d77165070eca809","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.3.tgz","fileCount":36,"unpackedSize":155876,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHBTuCRA9TVsSAnZWagAA3BYP/ReXOrB+Mq1HoFq/gquI\nbui08UhkpsWa+hh4sv/P+mdh3Twsyeai7OvKnCOCCdfPtL8FLjcbbedPVhS5\netpl57J+phWgRq3ib1CYzJjWGALVrNkDh3z3b0y8GBnXf4gv6OnZhZk/iTbX\nZ7MfeZrOodVzNCQEFqVty2EGqRSZYSmEcrMtiOnv9YjlDKgiX0wDxwtjbTPp\n/Y/98/2tSunIecYWvScDWcmIT9+UaNSiE7L8toKulpeC0dR/f0GWMiIi9s+B\nTMgntN9/YQy1PKaCOxijO0sV7/WiTD6Fc1cgpbrUlQzm6kf1K6MBjrEfZpmA\nMtTlXrikAYcPycFaPdCp+O8t0gjodwwIvHWibRuDln8tPEAH6xYYMHS/RAEd\nuSoClyo8isPQnchiDDnjEuzg6XjNU1b6nv2mJLSSKJArBYjNZ83ATDzHmwOr\nZwKfcj/MP+jr0IHwJp+QeqTvNJmSX6gg6979OMqb7GNXVEEQBTwnUrxTZN74\ngCilvaCrACfxcw6dHKHDfj2wdHLbx3neJwX5L0JwXMFGpToPBLOdsfjb15q9\nzVWLyfkG1sHnc6FjpXp2J+BJb+v7IgFQI1WLEdkClmUkFzYGC8F4wGf1CeAb\ni9cC2+4ZywKmRNIUMzLTxRM+zAUXwj+mLbfHtCvNmmZ1QjA5r0+lUowJcQGI\n9xF4\r\n=+wLc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtH7VVoYjFUZU/ccQJGVaJMtqQ+UnF71eZs5ofe09CnQIhAIgEvNL+JfvDNPSuPenm6wNOM+tZ8137GoRXoi3BWrwA"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.3_1629230317870_0.2384682519284449"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.4-rc.1":{"name":"ipfs-message-port-client","version":"0.8.4-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.15+abcca045","ipfs-message-port-protocol":"^0.9.1-rc.15+abcca045","ipfs-unixfs":"^5.0.0","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.1-rc.4+abcca045","ipfs-core":"^0.10.4-rc.1+abcca045","ipfs-message-port-server":"^0.9.1-rc.15+abcca045","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"abcca0453a2b769464a46b23d1f45319d62d0aec","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.4-rc.1","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-F7893OWoT/u8TyHD8L9JB27Lt6oX2Srb/9JwTk3GnMd3MZlx5IDM4Q6tmtkK0W1+f46aUrIudiwjrG2u98wXZw==","shasum":"005f7b4bbcae01bb3603a9811eef754127d188b3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.4-rc.1.tgz","fileCount":36,"unpackedSize":155963,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhHDB4CRA9TVsSAnZWagAA/PEP/R8jvcGrwAu/jwkWMk3Z\n9OCLwpTRcxf1iZJToOiqMqrQCNos/Vw++Oio/0hv/plwkrblHBycwvZJKHLH\nj3Ta7FVc25VK8ALN4TZffaLMCQ3vT6k5UR6Dng6JxZOQUCgxDcwjceSbjS77\nT8qIX+0KEQ+jcDinwcSUnu0i8p5rl7ZHJw8Qf79hdoLNEJkgQ5ZgSV+qiW60\nOTEzAyK0bMRPPtNLIQTVsJnhRJ6fgWywXw9VYsLAASPohqxt9oeC06j+LgCd\nTJjWr0QFEfA2IGFgHeezhISicILxF0D8eI6hTlywfGVsBW/Eo0HbNL+d6HLy\n2mMsiN0f28TxwfH9X2EZBeTIS+VXXXVgKl+h1qK1pYO/iZdGydyRMpSFJi3j\nV6AKnVvPpaQlgfy4a7azS6nW4MqXYEFsDDe6yUha4C3wuACjjrJBlM1Vauck\nc4GtC7zY+DbdVnStCAz7yr2cva72UDIcrDIcPbSgqB0zErrbuYqmV96Gzkdp\nshnbQAosf6nlmRL1wHrlWXxL/ASk92fDX6WOuYTNAIKcjHCGRoOVEimrz9EB\nZi2/SUF+nAL22gvVyTsqhu0eSBxczwVvm4AELiDpAu+WbJyAgMZ2Z1tXCwCb\nhhmyhSqRZgix3z6BIA20mVOVSbaY8ZvDaGyzxTHsG3xZC+kIulMhpEio60Ow\n0QlL\r\n=1S4g\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkH2T7H4rbXmK1+GYXO/1BmUIEXBUdlSf9ug7GPjh+4QIgZKBQbI1uSIN4YLfB9xUdpg8er+By8CNF9/EZsQXBEak="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.4-rc.1_1629237368020_0.5113809040937178"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.4-rc.3":{"name":"ipfs-message-port-client","version":"0.8.4-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.17+beeeff01","ipfs-message-port-protocol":"^0.9.1-rc.17+beeeff01","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.1-rc.6+beeeff01","ipfs-core":"^0.10.4-rc.3+beeeff01","ipfs-message-port-server":"^0.9.1-rc.17+beeeff01","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"beeeff017ba49c3a171d8990389a67eb5c3103ae","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.4-rc.3","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-7CEQbQ//yDsp4xE1ozWSxiNIeTn1hUpmGSfY+3c6oeXvXlwKJNUzWTaQ4aETddcYl8+Af6XLUnPVITN/A6xDSg==","shasum":"0779b86deb6d7e3b39d429c767e857bdbe1092d3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.4-rc.3.tgz","fileCount":36,"unpackedSize":156545,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJfIZCRA9TVsSAnZWagAAtYsP/Rfkq2lH4qOibxAHuPU5\n+iNLTahBT+0q94DoehQ/owx8enWVoS6QsdwsphKVQ7W7kCSgjTCt9fkVZs9e\n2PUYkv7NoeL2PqlotNTxKhXmRtXNMZHyoDqi7jmr2FxQvzKYsewI8skbCvvv\n5ccbmy56Jel2uB7gqPvGPVzk7JJPTDycAs4HHA77rd+qajAQef8lRGm69Iqt\nnLrSVgUlAPy6pujTVn8gc5Lr2zQn2HFEj45UjkEHW4f1uRfGsDzsGmzxsmds\nRMZTENGKk3Wa5ARiKqsZwhXs9UfEo3pSE7+qArgv7EruKZiHKYgT9L9XrRHo\nRQdG60HM8+gNkrciRBFQIivD1rTKdlXThk9tcDOkAD0plCD7owTsqvQbDOYt\ncopltITaOam5SVF0nJyMLclvabU88OclwJHufpuACttlXc44Tek2HJed9yl+\nyxxysjeRg/wO3vHsEzWe02mV8UvoAUnKNxn88Q514umQz8Qn2pvPHMg7Ch7q\ny50FR0/RD6gVUw0nfl6CGwWzPhu8YPVdw9Ejx4Z/uHrbZMw/Wg0kFkIe/wHL\ndVRJSv+vXTnqvIeq0TKqxFhQrrKtkxPk1L7Z6KkUp/TPNs7IaNgVWvfmrbdW\n0lxo1CrajRr9TQV15T5Ero3tBiCLds8UMQzMvL0F3nK7Bg1IL7n/JbHkjIMb\niXmF\r\n=js3R\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCky5HRguqhWktnzVuP4aDEqzsmWipCe4uayTQaCbkxvAIhAJNmUuz/8bKySV+a5nrPWYUMFWdUgeAxuVcdTKuVL99+"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.4-rc.3_1629876761085_0.22323706672205135"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.4-rc.4":{"name":"ipfs-message-port-client","version":"0.8.4-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.18+aded7dcd","ipfs-message-port-protocol":"^0.9.1-rc.18+aded7dcd","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.1-rc.7+aded7dcd","ipfs-core":"^0.10.4-rc.4+aded7dcd","ipfs-message-port-server":"^0.9.1-rc.18+aded7dcd","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"aded7dcd65896586bd46024bdb562c9646056b7a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.4-rc.4","_nodeVersion":"14.17.5","_npmVersion":"lerna/3.22.1/node@v14.17.5+x64 (linux)","dist":{"integrity":"sha512-Kwsi0u5YY/vD8sO2XSHY/w+7Hnz7e5YdISQ6/uu0GNSYvYPghwMKy/pm4dWKSKKVJSSZwlDIsKVmvgrQY9Ez/g==","shasum":"990ef2dd313b5e3c7346a9c30013994159e05856","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.4-rc.4.tgz","fileCount":36,"unpackedSize":156545,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJgT1CRA9TVsSAnZWagAAuHAP+QBO2m2k8IgnJ/F0JcOV\n8KOwnr2cri6qsm33OW4K4zcTUv2NwHOtJK171ZPeAP+WfdGauFh/fF/nDdsy\n4JLelua1p9/f9dz6LpGH9hQIFWq/jc3Qt+/llGhYrHlSie4H7vSlz7CUmG3W\nrHqpBs0c7rPDA/7ZR1CTtKtgw2+E8qwQQogK6Y0/kaeVFGJqX0MLuYt9XTj/\n6Jamph7TTVo4ihADNfrA+V1mLsDOFfvxTtQ5tYJOKvWlMT43m2+N2f3doNOS\noXJhrl2ycNbmfTDVwy2Po4sNEu7TGOP92k03L/rHEJaTI4+3q3ncp3W7cPCh\nnIgwhWk+8n4PzuqRw1Rvj7eTeG6Z14kXzpdwVI+IbIUfE/cg7IVuF8nrqRfR\nMCVs19yoKMY8yStr2U2YEqb0D+BTkfJKonpl2jzaIyyi8eFFQBDrkDRC1m4p\nYmm3Hes3wzbnjEQvx9wlekFOCllqBgk7z4Fm7utltVvRok1gc08gdzNbV49z\nKbLeXCo65X8sluOenWU3mSQ0Cgvp/1PjRG6j2RXUhfAEjKvBTa9OeYXU23t/\njxQvULtXUuxxR21gd0XaX52tYfyp8xQUeBYxewndsCFpK6t+DG0lD2sRZ3z2\nwIG3htUymY5hwdyasy4m9Aqyng90gmgZEBDEc82bOMHLbub5eYUtUApNOQUc\nJQCJ\r\n=wPQ6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDHSCMVj2X3mRMM8242fiDyvEojaKj2cJYxjigOYxo+4AiBtdPCLtdWIS0OfGyC8FMUBvZmofhuxeege/2AVZ8LTig=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.4-rc.4_1629881589487_0.08382575121723312"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.4":{"name":"ipfs-message-port-client","version":"0.8.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.0","ipfs-message-port-protocol":"^0.9.1","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.1","ipfs-core":"^0.10.4","ipfs-message-port-server":"^0.9.1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6ad2b40be914098981a2dbd370396599a918d0ee","_id":"ipfs-message-port-client@0.8.4","_nodeVersion":"16.7.0","_npmVersion":"lerna/3.22.1/node@v16.7.0+x64 (darwin)","dist":{"integrity":"sha512-dswxUc2s2FGdg6RVoUKecitn1jElA+bZUiV5qF/EcBReoxXQdOcORUx5GWbY8z+2dcU8PuCw6IG81bRggL1RMw==","shasum":"418d0b8f7b0c031d92924af2a215776e9668f36f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.4.tgz","fileCount":36,"unpackedSize":156658,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJmghCRA9TVsSAnZWagAAA/IP/iNECUGihVwynvSfkur4\nIS/cnvpMfgbSWS5XXUIW8sh6HD22IkjdiEIAi0XTiuW5eTKCh/ddR00IwsPQ\nYcejZHOawuNjssQN2Mize4YpimM7852JWhUYbWbbs0ciJzzVCNkmOsvbPIGk\n6/HH7XoDCkdp9cpjWagSphbGBHU5KK7bAsgUh1MlDyWIHWA65ZgEBqRFbPVf\nxjw8tX5VxIMYlDy3ryLUkFW3agFeg/rcr9Tu5XlydOlLEowfMxmqIa6srk+M\n4PqKJW2XDiONCGSqEEiS9p1sxuIcmVa90zFRj82KOqy9znJwFOg7Jm2rIoqx\nAboyk/v02p2+44KojfNYa0WfcIjfH5RqIIQ0sHttEjIFrYUXHa86Qe0lZ2d9\nWjCzB9vxKJb7fUBwqEfIBv6/foj/Hw+QmmI5GVr2syjeF4IxyAcPXkNZVlPH\nehRd2KrE3Wk66IhzoYaAqixCifbFG40xEl0lsfKn6hbTVuO2avZH6Uyowf7R\ntKNJ4Tje+Z+9hBq2OP6at5pK1U+x5a1pC1pXosHmgSdwQNGzxhnyTHxrCbc4\nuU2MEbavX1esW8wCXGVB7u5T4E25auRklGZmryMcwES11SWs2ZRVFA1rYf25\npAfNAETVZH6s+lJIz8u98pAVZkQYbqXoZB05U6p8nVGN410NDOCzgUdAC348\nZIZv\r\n=qbiT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF/oAX+j1xigQTN7wHQz5+ZkaHCJFPIqSogft6tnA8obAiBB03nmnQgaYerksRQJagcFsFmOqUU09ioECB1/JpM0OQ=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.4_1629906977426_0.8390098437342806"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.2":{"name":"ipfs-message-port-client","version":"0.8.5-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.25+ebb6c552","ipfs-message-port-protocol":"^0.9.2-rc.2+ebb6c552","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.2-rc.2+ebb6c552","ipfs-core":"^0.10.5-rc.2+ebb6c552","ipfs-message-port-server":"^0.9.2-rc.2+ebb6c552","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"ebb6c5528eee66d07ee64c4ce105e9b1228cf857","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.2","_nodeVersion":"16.8.0","_npmVersion":"lerna/3.22.1/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-/UwTUbSKNWbv746XpNletyf6O59Ft+YVslUAdegGnIGjKFHmQkpCdejTIQl9OUawo/9COS6F4Yt7jS/xDz06Jg==","shasum":"924d168e59c54b4c5fd9343d81a0a41da56e3efb","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.2.tgz","fileCount":36,"unpackedSize":156743,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJ2NtCRA9TVsSAnZWagAAuhsP/jECK4xjPrmBdV7ds+o4\nEk7Pre3lRpm8B1TUdm1+qavRTetdX2xuMbBpBX6tdPyHs8sfg/ItKYt39Xka\n8kevkCdqV9c9OW2LyvWxoJPsaZuk8sYop7gEOmhqX8Dd+nHA6XvnUy0AazIq\n3dLrPq5tlHdQ+jFREjALClZhUXyUpU77xHsEKtCgaUP2chypuWrdQPrHudYl\ne0e40I/Y40F5hncMHa+7PBf1u1FM8B1H2cQJfNNx99eep7mcXguA4qht1UQg\n30vPZZ6QykQWa/fWneDWaTs3rreVhnxnPPz2rirpdiQYFMYz+aFxFjjJfOe8\ni1hUFUnoR5727fgGJc5EcxQuwI9a3Ccx09JI80bmzlLCkx2yy9p76cCcgD+Z\nvWUGC0vfHpOr11EEG5QO7jH2bL5kPL0mV3xeqabvUQHFB4I7nq6oOuAJLVzO\nZR3ZeIX8qCLkSkMW3hgSdE/49HNYNrdFunf/IX7oqUzbDTR/Y6ZXs7ZnbtFE\nTDKemPI5mDKbr43tz5/qSVrFNfLNXSDAgQ1pzdpsw+9xguVuhjayX3cn+inP\nwq7PA57uzzRNO1eEOvtsxJ1C0Sr4u5QswIenL4uJT56BMeGL8nb5HrBtZSgG\nk+VQkb8+iEVIAagMErOnG/tfOzjYSKFksOB7eyjyFAp4b0wb1zFA0UN34kZo\nrR22\r\n=WqKc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD2Y+fW30oWS0X1wyua3swRYxWJWaSdnbIWGklLevgKSQIhANXk+CeGJgbHtdeYzCRbGff6quVKuOuUTi4PosZYG6+c"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.2_1629971309183_0.07805634573986131"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.3":{"name":"ipfs-message-port-client","version":"0.8.5-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.26+6c46a3cd","ipfs-message-port-protocol":"^0.9.2-rc.3+6c46a3cd","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^34.0.2","interface-ipfs-core":"^0.150.2-rc.3+6c46a3cd","ipfs-core":"^0.10.5-rc.3+6c46a3cd","ipfs-message-port-server":"^0.9.2-rc.3+6c46a3cd","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6c46a3cdaf6e9f8756632e501019923a01503282","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.3","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-6gE/hn8Qr7eUgMuU/EEjR5VUu196TkfG8k8bsfvCIV/pNzgQJK3jCUuXiuxTJ/k3PEsbcoPxuZx0bttachAe3A==","shasum":"fb85609aec36d46215a09a567514abb8b3dcc695","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.3.tgz","fileCount":35,"unpackedSize":147472,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJ3aZCRA9TVsSAnZWagAA/CMQAIicaIjLgH/B6x/NJnQ2\nH6tGrNBfhZXXGQnnIAwQVdh6ATiqetkJpuGyph2FMDVQpcf1bGCpHM8Gs1X6\n8ht2LQhq88c/lDEINoUqsGsv6w0s7u2WiRIPkhoO+w1kk4y3dZENscdbW0Y8\n/dpNPaeoH3WQZX/zDEv2cVOEc6Z448rb/Emf8YMmX0SQ1OXm/mbRzmBPNyAf\nOfvEWmWC2dki063MVhPsyazofCu/Yicb6JV/8W39x1fLHhr1BUYTDwktyVpg\nuF4HKH9eDtG0hqocSwjQ8W7ebvqua4acbEbttp0Ib53O0BvUy5XquAh06AAx\n9Nse9CaJyFnyhDSj1b5kS3W/tIiTOYuYw+ZjixCSRR2sAghLAhqX3j6oWr8b\n8Eav4mY0VFhWxaOFTL0K6TFHiXLgs4j7Wgii3uTsbzvkBnBYQ4usWaAdLWhF\nkuuLIl0FjUleBpOEHkySm7CucnOfd2VXgP/HMLuB12qvEPUpKWVFAGKuApAG\nx2kbdKkWKSxxM9Fz/PGgfYIezpEvwqt9JXKekSNT/WqhdAuCfuWv0StTYZ/f\ne8onqMEzKokUtC3vYjsQ8dUMgXTT46ZDNOtR53daj5ntS+HFTj6uz3+/RVh9\nIED7Ar77ny07mUWCX4Z1ce5T3HANt9duW6uBG/Dp3mFZZiIp4lfdaIJZHRr0\nudDD\r\n=kIvA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8cM9umxKCesx1zAa8cOlzVZBNZ4ix3Qd6goVc1RLD3gIhAK+RrX4U9TvHUtLC5TPZWO3GNQuItw+jGXCNuY8GtScV"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.3_1629976217772_0.4063356136312848"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.4":{"name":"ipfs-message-port-client","version":"0.8.5-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.27+1ae25d01","ipfs-message-port-protocol":"^0.9.2-rc.4+1ae25d01","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.2","interface-ipfs-core":"^0.150.2-rc.4+1ae25d01","ipfs-core":"^0.10.5-rc.4+1ae25d01","ipfs-message-port-server":"^0.9.2-rc.4+1ae25d01","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"1ae25d01d93d192d8242c7ee48ba338064ac9e03","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.4","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-7GShyx8mSjt9Hv0n8Zk6qLN/fz+yyx06WFDJIhVQJIEkxjFu9QqTq0klL62eDgjXflnDGR3vmxwT2MlQSNtGzA==","shasum":"b39df68af2f5e6d754a721792657e86375249c6a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.4.tgz","fileCount":35,"unpackedSize":147472,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJ54FCRA9TVsSAnZWagAAMI4P/0nZDXVSGj7GGFw3mg7p\noUiC7SbNNxnLgsVUnRFTcttvHtG18pYQVbHyfJeFGK0NfGtj+2aICzhRvbOK\ntVDYId52SVH8AfeN927xrkYF421KcKENZD2IGFAdf/DlPCFITzW5sts+Ctrl\nvjuEeaYQ0jwTEI8UO9YLWsyKdWLFSS8h1fXNzgy6WbOfqSnyDKDMP65JMwTY\n2+9PRbKR+TUcMzHe6IOXENbG2SDoTjeBM89pD2YGSkP+KcMoXOQnOWuy7tlE\na44XEQ4YhH/2f1ngggUo0y0qNtbS+k7I30MnNXSMPX0vHLyJUHbW7HTJxWDe\nAtC7vHJZpRWBPgeKrK/TQTGgZ2QO55G5jfQsSDdQMZArP0lhuXkrW2vyDQVo\njQs8M9NQKS1dS/m7IHVIFTR3ZMRiAHVIabxXOJfwZF4UNR67dR6fooUAd31V\nLvXd/2pZc+xOYoKQf++qod7HWc0NhkBoGR2TCBM6y4319pVVjcueoJFHtrVe\n1DvTuiym2ZLaz5sIPHud7sT/Y1Tm2zwgA3CR2u0CIWlw5yajS39VxcoWdDA9\ne8KDaOZbzQTfgDhBBFxWkpzQBcMW6fUpITBAbWooLJUdv4cSpYKDEoKTKfdK\nZUvC+E+Y6vdXurpG1d3OXNllRtQAwLA5yLDlWACUV5R22hADXIgiR4CxlGJ5\n6wmj\r\n=pgpw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHO2S39k9+EkUGUB7CLSoaEQD3Gwamx0l2LyiNJqviknAiEAnyHTRgLiLh9F4yzlORZiUXYwjDMl+oEHMgwjNh83hXk="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.4_1629986309571_0.8614468216464346"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.5":{"name":"ipfs-message-port-client","version":"0.8.5-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.28+6737f38a","ipfs-message-port-protocol":"^0.9.2-rc.5+6737f38a","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.2","interface-ipfs-core":"^0.150.2-rc.5+6737f38a","ipfs-core":"^0.10.5-rc.5+6737f38a","ipfs-message-port-server":"^0.9.2-rc.5+6737f38a","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6737f38a27cfd7a7fc44afeedb1a7465cb17a3c9","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.5","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-52IXIa9aabQ/igCvBv4ne4nqT/LZ+Ohikao7hfBGdg5PQ3SkLNF3lFFUO8J6VzZ5mcwIunZhuvWZ1a+NTxmibA==","shasum":"bcf3190606c730c12f400ca615f5e951db7a76db","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.5.tgz","fileCount":35,"unpackedSize":147472,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJ7abCRA9TVsSAnZWagAAcxsQAIDeQmQc7+OW1YOso6A+\nQ1pLxnS/5ZIQYpm+V8zLzAmQVcCnHqGvuAF57EVq1dhFqG0Z+y+uBHhgcqMt\nm2SAil7svDwEezhoUHrP54MEj/kP+iEYN6rCZf1aTk7s5xWNCp32ceO1szGF\nDMgseghglr7ydrxZT1Noqrd3BW26NwGjzQuXdhnzBiyZPxzJjunoUNmcXiDM\nSQLBZGjAf2xMCbsjyzlXpy1+xUO/bFf1ZU/WUxbbeWDqQzrYRpeaAOLlxMDD\nmcaFHaxKygejBm2zzcTDo30adLDLVp200oEbNmvzu6+awnvYcmcevlF4zuoS\nAKRaGOS6J4ukagbzFcL53KsM2yTFGDJNE8l+UwBy4KpYqdUg4wv1dDXUrraa\nJHbJEZl5MZnxptmCaHyAJoP5b6ByMbVEY5CISrxVXnWB+l8G5xQptBJ5/y8t\nqEGCv6LuOl7Rna6MUvEM7s5uCUOmU0JT7THMHsH6TgQJWKHvamTaj2TiXf6b\nW8cK1n7bJo60N/WQbfYVuQ7bDg4BRwhihvfRRCCzwhQTxxR2PDA37Sbu/PKW\nnO99MssX0u9XFJotrHC0XElH/ZPxm0KzU/uaYvlAADYaS4JspnViAdYM3y4b\nDlu+LppR/YJ72CB8Mn8hcsbtQoxkDlO4X7+CgEQOuDEcsZhtQ8ruJC2UZ7JQ\no+s/\r\n=NbGy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDdFFTvyftOTmVEBnDdjrgog6qYXEE//gX8RWymQMh8eAIgG4dRPs4t9sWrutwl0AOhT5iDL3IRvMccWyG91eauhkw="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.5_1629992603567_0.717965933690268"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.6":{"name":"ipfs-message-port-client","version":"0.8.5-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.29+100f54f5","ipfs-message-port-protocol":"^0.9.2-rc.6+100f54f5","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.2","interface-ipfs-core":"^0.150.2-rc.6+100f54f5","ipfs-core":"^0.10.5-rc.6+100f54f5","ipfs-message-port-server":"^0.9.2-rc.6+100f54f5","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"100f54f5b6e29ff64d9afb9c2c326707c5097cb5","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.6","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-mEBMtZv0l/UdbYdXLRr4lq9RyKpo036X/ABSg2zW55xolMGw76Uj7WrOzZh9IiQI1m57clXkd5xHLtUscO8uQg==","shasum":"eee21fc640139ec8878308769276b5eee6b55ee9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.6.tgz","fileCount":36,"unpackedSize":147560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLjANCRA9TVsSAnZWagAATJQP/2+mWAFFnpMpEtGWO5TR\nI7RmLjawKxQoXZD80TLCfaTRCP+x4oJ95B0urIiz0Y7OWdv1FnBl0BaOSynW\nAtTUSZjRqvfRosqrhzdpvPnHZj1LZChJ4srmc2dWjQLFXq653fBSBIR6yito\nL3HrxT95ipnWVoYhuCr0qqrD4jgw3NfgBl70xVKdFKqdQqQLQFXeyglAhZg7\ntEASNIAX96bWrfwdtBy13xDiRC8AB5H8zS40AHtzZPRJ18ay/E6uvVuJPg2J\nb+yeGPXrjWvmag6JbwR9x8ANKccLb5cLpCBMdEXkUkxIZJN8sWQ0YtNKBFD7\nAcmnloejOIuhu7br6AFS0TOsjrC0T7gOzDGMV8hXXS9+fW2uXR6R9C1lkjlB\n1y/MNJVWRnSPN/JDFqvkBob5Fpbffk0vFnoTHhqdEtOcx9JjLQ4XQaYEey81\n9ly9e9wDpaStTSkO/kICrxkRXDGBooBjErEtsOupHPpX4zjZjiKh7YlffsBo\noya9+hujHDx17Zl9QLi5AxvRIZI+KRS8Qn7ZI9dp5C4KzMP04XrgGgvcpJXI\nCNf2h5k9TNGPvTc9VNzP9s/5LeihKByBJM6/A6+SiIEwf+F18Di1Jc+znF00\ns6+1z7b4wJ8ySXpNDSGiWwkExsvhPtCfmKfG0qt9p19piD3A4JepZQ5Ixe/W\nIZTe\r\n=5OBl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDd9rOxQj1HzhQYIxEciAYUgPf1MV3kYCWvuP3UyYIX0QIgH5FiD6LJZdcoXZKzLa+JVFOTz0J9HT36NHrIvkvJfBQ="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.6_1630416909517_0.6084184058445627"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.7":{"name":"ipfs-message-port-client","version":"0.8.5-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.30+be900895","ipfs-message-port-protocol":"^0.9.2-rc.7+be900895","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.2","interface-ipfs-core":"^0.150.2-rc.7+be900895","ipfs-core":"^0.10.5-rc.7+be900895","ipfs-message-port-server":"^0.9.2-rc.7+be900895","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"be90089554b3ff3d7adb02e76076e5cfa1d82572","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.7","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-etHSJK7bw5TJn/cNUk4QeV56cheVG7Pyp+wyC/43ME4LGFbUWpUNMOi60IFWj6/waEuyazMt+EGmjW9XuCfyRQ==","shasum":"250a53a880588e0a040133120585014cd44a9f66","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.7.tgz","fileCount":36,"unpackedSize":147560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMOb4CRA9TVsSAnZWagAAd0MP/RCrbAVYoHpmechmocS4\nPY6dajsOZaz9HaRTfpU5JJOJH4NAJhf+H5fvsPVv9AFnTHohfnvasg4NdwlW\n+yUaN6ijXEj2RruupLy3DkVCRvfFff8b2U4Ws6kHuIB16KBcr8z6y6GgIAbf\nfBBo7kEYgE5emNp2H9+SalnuXGeS7buhWcNP79AD3nPvcPVuff597PBHMRZR\n7Cw9IIUVbuav+s5wpk3Zro+gsKDnndmajuTJqOQwwShPzP7FDnv5xG0+8qE2\nZND77iwp0NKDIbdgygVprVQgSPUF791PtdDYyvxhGF+XNsT87vy4NiusRj/w\nE+eyKRmfV/age6uztFs9e4DRqvJvwkU2lMBuidyfNQ8Wk6WeMLcfF6Xbo0Ox\nh5Q1t3n87vqRz6PftqtAprfyTACGRpKwPpmAkz47RIzxnRcSa/KTKjOduUOX\nPOKmCpSjkD8/ofp0ynlDL2rlfmWAHYVVYOHJO4+GvjI5z6r/MmZhOoA5rBj1\ntcWOBs2VLz5jqgr79IUASe4ZN9soAmhiCXMmqw/mwL7UEebGnwMs8I3lk4sY\nIEbgmQe+8kC0qeiRjNWBPWG7Z3sPtru20pq/dPzjGFGrSGyrIIMR3AHXyK/D\nAXTNpiGvTZ1fIyTfJIsRLDSJ7Ndr+fBHXIT2oVEte/uQ+cqq9wrL/mFF2PDe\n6LCo\r\n=LJOH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7RpdMoNditJ3Dnz8FKVtDEHJ7by8gfvy86Rq4vVDCJAIgERsZ5ODzlV8AgSJ3p/m2Dumz2Z5cABD4SZoiagSwPp8="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.7_1630594808402_0.28120487671167105"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5-rc.8":{"name":"ipfs-message-port-client","version":"0.8.5-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1-rc.31+c4f96fac","ipfs-message-port-protocol":"^0.9.2-rc.8+c4f96fac","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.2","interface-ipfs-core":"^0.150.2-rc.8+c4f96fac","ipfs-core":"^0.10.5-rc.8+c4f96fac","ipfs-message-port-server":"^0.9.2-rc.8+c4f96fac","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"c4f96faca331a2e0db2d6de35a804bf2b9457c80","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.5-rc.8","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-lc7Va1UKUGfC/voYtnv3hYYdM297P3Fjg+WRPkgrS7DdhMflRioy6eYh6sWpYgna7nfQylIIUgMpnObpNQIGnQ==","shasum":"8b4594fdf65d2962531dccb6c381b247125cc452","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5-rc.8.tgz","fileCount":36,"unpackedSize":147560,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMQw9CRA9TVsSAnZWagAAcs0P/195EtbVpoxkqQBnRST8\nU3NX9xmtc0PkHvDvjaNnFGfCjdiXgWX1g8KxUFCUtuWrpuvLEKwq8VIN/ed2\nQyDkYNjlty0GAvIwyGh03jy/dOWAiLcAtg+9RaBbxUABOmkjlCxOGT0qDVQz\nQJ/FHaOAhJ+PO+6nn/XoeW+azXPhFPxsws6Ov2QNnT8e9h6BSA6P3oPMtNhK\nP5oSLZ1UycYbRze1dE/YD5qQausGLY3ymT9KvDEmkZ45NKLuaxVSXziGrUq2\ne9F6f6QAvhhC3m/Z9LIDaYKBu1+SScsTcYY8hbT8gnIlLJVmSgEDWj+GKl2p\nsKZoki6wKoPFBicXdmInfcL+aFj8Uk7yO5oRoWv/MSdvaSDq4fgW1jk7Lz7z\nZcF68AKxKxmEbtqq71Sm+VEV78WJm+BoDv87oMLfRk/XwJBCSpBSJDyCNbUv\nvrLoAVlqv0nJ6KjWJPdP79Q2rsSrhQ3rKrBn5SdWsE3s7DKCCKFQgMhvH7cf\n3XItL5GaY67TQzbyML7gRlk+2XSBt+3vgY8pnml1yVFFeIYsmCp2rb2e91Zs\nISGi44ERg6ecOU6t4d5t2ifkHiWLK5uoy/TKYQNAZA8kEbKtqMQzkau9hf9I\nX/RdjwyNVPR41bgjRbPF1jpnabkKKdYCdxWrhCaGAOBlIIpRyXUzwZ8M23rK\nvUfo\r\n=rORM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1r/iOu1WEu0gGnAUvnE6izabYextbc1dYVJtW4BnomgIhAJPGoqEz4/OVvnUmiVlQL43pB5vq+uyoBLZQGHZt22yz"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5-rc.8_1630604349075_0.12782284636375385"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.5":{"name":"ipfs-message-port-client","version":"0.8.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1","ipfs-message-port-protocol":"^0.9.2","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.2","ipfs-core":"^0.10.5","ipfs-message-port-server":"^0.9.2","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"9d92e8079694dfbc7be262021cb9d41e6c5e2c07","_id":"ipfs-message-port-client@0.8.5","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-mB2yOA7lI2YLD4+tcnybLanT//q94J1ZdJICJSZWUOvy/zh/TunrT5Kln5fZNUoE6X7PgbSf/tAb0jf+c8LH2A==","shasum":"32d7c3bac3690bf87d0ed69d99a98d4ac71f23cc","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.5.tgz","fileCount":36,"unpackedSize":147541,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhMRWdCRA9TVsSAnZWagAAAagP/2SxnYqKCvuz6UXXANN4\nneLhoOi2kGcF7Ay6xn9vkzK/z22tbDH/1Mnewp9z+m4lIcZehjY6scaHdrpf\noIMk0Df1K1quA9JqNTys5qsHf5arrGuZN4ksyfuzjF2M7Tf+S08p/0ExNHES\n/vuEw13TGc8CIi9khwY7ouVTfZq0GEq8sQ4wmHnTG5GaNH5cq3Zp7IJ1fldD\nd/93oqvbvBZI7QP9n/CZZYEHvoK3BFUSUYFQ7cNL41qRZLnvx7qeI6noRP4i\nHr+F4f/SM7PAPUCSdLDsek8h6FuGJv+VyQIaS5qBCKew25Lw5ErKbBYDI2xS\nQuSslFJFJ+nOboyvYwwGZXZm084DGB6cgxNLf7Tij9uWLzS3RMR1Q/GeHMij\n9AmuAk210pyM9K3kzsT36sVfl1wm++UzZokdcRpAsZaUrgrS9qKpVPiSAtfj\ngSEx5qSmrUIwB77FY4hDgsDl9g7HwQIwfcKknN19YbOHX6zme3SGTRFl3/ot\nDUe7j/mscEykK/1e1wAeZe7VlDlEfbTk1Li+9FqVXm0RMvNTHx2I/rBXYrAW\nWuxL4h2dL4K0NldqXCMxlAPzpTpi0ij7tt8wM/biaXnN6LVzoSghdl1t6OKM\n8v35vwJ9qJQuQzMpn7zK4yJnCyE3GvToFjuqd7E/4oPiF2KTu6XOC43LYevr\naObz\r\n=mXZ+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNvh6umya4K8ax+Dl/oPYw/e8cD7CmbT+B2EWlesb5mwIhAKoOgjEyzxTpQxfu9eTx0SyDwPp9cBiSCP/RGHvFznpR"}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.5_1630606749595_0.8711335209423301"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.6-rc.1":{"name":"ipfs-message-port-client","version":"0.8.6-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2-rc.1+5cd78e56","ipfs-message-port-protocol":"^0.9.3-rc.1+5cd78e56","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3-rc.1+5cd78e56","ipfs-core":"^0.10.6-rc.1+5cd78e56","ipfs-message-port-server":"^0.9.3-rc.1+5cd78e56","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"5cd78e56b8344b3f71fc7c578c4a50d92c25f0e8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.6-rc.1","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-/NttpNihlxQIaezoKuQHFcn8DH6Q6SwBUdHcoS0SwwgpyL8N8puUkH/CXIVQIVL4EYjZPWTJCB0OmDqxNnNjIg==","shasum":"3b56304ce2ad269412c44f2f80e8eb333ff5e9c2","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.6-rc.1.tgz","fileCount":36,"unpackedSize":147625,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhNfkvCRA9TVsSAnZWagAAAMsP/iv7ihaBi3SmVP1knOfw\n3Yau+uyxP6CQ+dS4zv9RQqftWTrUCbgP5RQu3fE8msOMg6rf0PRpjVPmWq+J\nRWaQSedPa5NWPYbbPzrtwy9e5T72rxnvbpt5tb4Zvf68oTE9mw6403OvgPJ/\nYHQBdjxuZnSVihyqLgCXthjY+W5Y93IOxJ70ur1nywBWDCH+dmJjTC5CNY50\nuSSOFsFDCJia4ivS7Dl+KTuCQwUnncTG1BOvXF8KG+J7mTF4VU+2B8m6WJXh\n/2h44f3Ms7qze4rHdb/8zFiX2LlCYQfuOOUygcD2vS7HBZPcXbtoyglZUgNl\nCL0qVqH5V7sr2+jC2zc+6lAUEzc4iMC0ltXNHm8z+WKFqUnpnXCKYDS355Lv\nE+YXjJL9SFT1H4jy3+Xk11yJOktkb/H5Q+QEDiHmJ3ITrqPd5RvNbFc/gaI2\n7H+El2SLPdPZ5MvmZ/gOqgg/VFXm/Nj44sjgwW2CgGYT72CCy3davf+xwkky\nvMnfBDpDqB7S7bKNMa9SDYEUK5kIG0qKcR6nzd8z8+EIpBMJu7FohMPmP3UX\nIPqMwAxlVlKwz9ZN9g2rRbyPqPyuhzZXkoCQuUcNrQhmqrEtAAiOTib4heYh\nQtCaFJ4DX0VbDcLra0xdjGF1YcZoKhVxslIGeZF7k5FZhOFCZMh+FkfKv5rV\nbawR\r\n=1A9x\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0vAS5TSChAZW+aZ/qoAdz84cl/SRmqZI2yHe41VSpAgIgMcVlK7o2DrRG9bgjxFW2OMv/c69vnX7zILc6FUupTsk="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.6-rc.1_1630927150863_0.7961845172055337"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.6-rc.2":{"name":"ipfs-message-port-client","version":"0.8.6-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2-rc.2+2be33543","ipfs-message-port-protocol":"^0.9.3-rc.2+2be33543","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3-rc.2+2be33543","ipfs-core":"^0.10.6-rc.2+2be33543","ipfs-message-port-server":"^0.9.3-rc.2+2be33543","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"2be33543a07c14a604fd484a481032dd75fd8235","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.6-rc.2","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (linux)","dist":{"integrity":"sha512-d/kJvuLUWVekjXS+TKMNeQVmTSAHqqXLfTHaQYsmgotf35Z7DRwW/9qIUeriFNLh0M7ERYbn6/Gt1dnyakIJUg==","shasum":"96e844096b3a52d454095d6c4ca2d5523930626b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.6-rc.2.tgz","fileCount":36,"unpackedSize":147625,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhNi15CRA9TVsSAnZWagAAUPgQAJOFKyG3Jgk1C74Cpwnf\nX1GotbVXmty/SPf+37m8Ly6OpbYrEeCEGAHZPcT7DK3iMj/TTmhxYk73sOXE\nDPcIulDz/IZSdyrsvkc60t+wBx6AISGl7XrAYaFmgsEnUbNUfSAt/fx+uKa+\nUhx74sUBIwVOpMGRJWdoath1GWRyH8LJ2uHxBiXiMGg9z7ypl1HdLFLeNpC2\nF8n4HZOJvok1ya1GuKDm23FhL/cOdOTPG7IvgnMzXqqTsO1E7kZPXVmsS71A\nsI+QopugxE/8V2ELlm0stN9b5PUIjjpBMAMlLvw0iVr9/v9jbnUSN9vm/12i\n83dI30/1vtLnCBY6+dm+uUvJqHuiHx6b4we6nL/DXn3B4efgTC4u4a2AgBVz\nHulr6HSxMJ1+Umi2QlFrVbeL0ELsux9sYHAtkhKh7nF5DG1S+7HZvWQe2qM+\nVuurq7AXWwzb6S8uqWgejyJjgG2tSxxfYdUL5E0XsoC3KYOj8iN9vviyDnVu\nLs/RVHe76MB5j07eXr7z99qGoLIKonuxN9i7Sk3jncIwUR+1z+KdXk9h24y5\na7bWFsYihX0WiOtjd+U/AUQyPaM0Z52huo8MpD4E3IQ3bqZfn1CuuVGhK5C7\nG0jdvbT2lf9JTJ7KoT3zKor8x78KMLi4JX2YGjChOpQ4UnaPOR2oeHt5SEnT\nKOaW\r\n=qoj9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDei9pKChXISE8Jz2fQl1y0rIlj8rtF/8kBJtaIRtMUDAIgN9E5XB8QPjP8L+SCUhLgXqXjVrW5kOIs8SPaClnDQXA="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.6-rc.2_1630940537293_0.7874109127775586"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.6-rc.4":{"name":"ipfs-message-port-client","version":"0.8.6-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2-rc.4+84c772ce","ipfs-message-port-protocol":"^0.9.3-rc.4+84c772ce","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3-rc.4+84c772ce","ipfs-core":"^0.10.6-rc.4+84c772ce","ipfs-message-port-server":"^0.9.3-rc.4+84c772ce","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"84c772cecffaf4deaf967c0c4e9d49c3dda73237","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.6-rc.4","_nodeVersion":"16.9.0","_npmVersion":"lerna/4.0.0/node@v16.9.0+x64 (linux)","dist":{"integrity":"sha512-XjV2Q5RTzY7MP5vJApda48QUm1wZXiG04jHfRGk6xCXWWu9PJW70jRZwOkJVdrHDJuB+M4CdwkmSTDSM7R5jSw==","shasum":"6d2ab83c96438042d7456dc37cf56fe47e44663f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.6-rc.4.tgz","fileCount":36,"unpackedSize":147625,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhN5t+CRA9TVsSAnZWagAALLoP/RWxBsl234bi7Dvqqf7d\nrI8PyWz1GSg5+/uaY1Tbuy2CAPT/jIvP65oc7dgn53flm6/cIPsW2UJiJw68\n9XgrTGlSnxOHFp2vCIBV3FAVoonz9/pIgSNSuftsmVU/DHjnTMrIu0yYXAmh\ne0qAHO65axwLJJkXTexFkfa4Bl+el0aNDDJjzaj6hsxclI8mJ7LjTUxCH1Lu\nF1UluwBEgs6TzD5FcayGOyv7qFzQkRUJW5TU4I5UHc49Vuw2jAr55sY5uKxS\n34/vkYw9Fbt1XDvkseM8dJB7wKE06l92EKTUdG9XV0nbRIoLI7vQceeNN6Gk\nvOvsKoWYEyC8IASEKbK2SlUH1Osuz4WjvKRpkunYk51EOxoYPliOmrYEje6X\nHUYtK0uaqq18PFQGd9Hi2vOAaA4zM8C49aipDSyB04RfpYCkyCbWBCMFCISw\nuPGGWPg0NodnUR4hUTRDY3mbgIbOlRJqqJq/LdWUiz/5NTsDW6fffCu773Kq\nip32AQWbW7OSQCKVHsQvHW/8XZTdjA557SJsHB7mKjrnHAZFLktF63ow6cLe\n42UtrfOFGpsb2HaBh85tTELHC/bLoSDN32BFHsFiv62XLfHclZotXTj0ptVr\nokhHv/ui80+dd0PhTO+SUX/R9/ZRYNJN63m665puJVRmKitCy+GBfRrmEIp4\n/lqF\r\n=Gz2h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCprr/2zU9FPK0+QnoQG1fJnBzzayZlYpMMseqe2WXa/AIgcl8bXFpjRRqD9ooDngG9jaKIMviKSGjg/KqO+7lZEyw="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.6-rc.4_1631034237915_0.534719021123724"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.6-rc.5":{"name":"ipfs-message-port-client","version":"0.8.6-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2-rc.5+b072ef16","ipfs-message-port-protocol":"^0.9.3-rc.5+b072ef16","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3-rc.5+b072ef16","ipfs-core":"^0.10.6-rc.5+b072ef16","ipfs-message-port-server":"^0.9.3-rc.5+b072ef16","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b072ef1635759a3d64e02afd7a6d853a94cc06a5","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.6-rc.5","_nodeVersion":"16.9.0","_npmVersion":"lerna/4.0.0/node@v16.9.0+x64 (linux)","dist":{"integrity":"sha512-7YAgvkWJ9AamynSK9HLFtjQZCrqAlo5ZBJJNqyIL+yLQ2xDxxktokGgoww5eU+I4ejAFKXR1ctoj3iEwEMjtjQ==","shasum":"ed6a250f7fb391ff948b3eaec314ed3daff8c460","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.6-rc.5.tgz","fileCount":36,"unpackedSize":147625,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOINvCRA9TVsSAnZWagAAEkAP/2guUAqAN+TYhHo7TZnJ\n55aAhK1+ts642pgsy6qdqxIqNN6RdX8DCA7lrE81NEAE0j/n+0aeUmw3NH5/\nygIuoJE/Lq/oV6T1VR/k5/MSbswW782ncJEuavOaVJq2S41fqB7T+zVjGtjZ\nQJEcFw59VuOFRv9IQ3vAcqrMHub/k+ShxbzOoxdle4bLPFzQ3/PuTFHQYYuu\nKnKBXADYjJEA3Ag8z/xRaaPj2u7OEQEFuJOcwo7cg3Oz7nqTkMCfl+h5u3ta\nUQXIwjLlsPA9fCu2hJNzy2QizpfRw71OMk1Ouym6Vkq871+F7XxxfcYyq6wn\nzGTOaWIPntjKNgslnXHgnJ9eq3c4tNO5nE88IaUDVPgyGkcUjA8asqNqEdCh\nz8E2DAG2eAVHTgMcX6n/EuFf7KBJbgEUhweiEffR791Jz3QlAM1JwE23CToE\nGQTjZG+KoIhLabMtS5mVjSqgq1dzv3jh+wC4vD+bry9RMr8oYf1hKqpDlhLm\nRNrmomYHmyuqtT2qGvnfsr8hqEDvHGf9rvrqDTPugJOL0XinfrT62aOwRNqS\nd8c6FDB/of7hMsqDrIkDuP2J/IsuIs1WkOtxwBUPtKN9VF10sddDXZlupykO\nNnMuhi5HMxcpg20bQFbJZFIFNFvutDISs3v9sSLKVGhME8weikhrwXIrVBpx\n/RKh\r\n=xwkV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG8cV2JbJeOCUCGDO5IzXhDYkiED8y/hna8dxATx3p22AiEA3q+BgbQeRroVG9qFptyrDM8dBm5Ev/z1eBRtifSAuWQ="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.6-rc.5_1631093615464_0.29190210473516"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.6":{"name":"ipfs-message-port-client","version":"0.8.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.1","ipfs-message-port-protocol":"^0.9.2","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.2","ipfs-core":"^0.10.6","ipfs-message-port-server":"^0.9.2","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7555dc28a904958b375c4037258759061745b3b6","_id":"ipfs-message-port-client@0.8.6","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-UnICRhZn/EBmqgRIjU/AimGcTVGPSrx6rGP2reU/ozwI1cv6vJchJB3+FSA/HnUWaTwiXABFGbYzijuqkbXziA==","shasum":"511cc5c322828629e9144df01551a13a5a9e48e4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.6.tgz","fileCount":36,"unpackedSize":147541,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhOIoiCRA9TVsSAnZWagAAnP8P/1Lqkbu/up+7Swfg1vwi\ngzNXUfnnXwm80dPuugKFlvFIbe2x8r17i3co9HDLWzj9rUcWH1WMlG5obyk0\nhVDe0Y/Pk6zDakBe7h9vP471hbaFxx8F8lthlXUE7Ixdj0sArSghiG03hqwG\npba2PPiss+RtF9KecSyRkoTOTUate6cVaEztPpT9Daeo/IHdn+YZg2F8zfm0\n+wEcPMRgMfzlArcXjFQ9jS4BNHEUrW6FS1k78a0/fCEDCp41qTyw7lPTG0mX\nPgBeRKN+vncC9Zv6M4NI+P3+c9jP4PFDK6AnyXR5KTmuctnCfiuGyxSFBoeK\nOtGBbixyI8RAubSoMzn947ZURUNvy5DL9dlZpoNei3MGMuoYoeQwYTuADVE0\nmlAm2LpatvdgUhazytBQViiLkXNDXZaLUNqTiQtBK3EpWGiQzGYfob9+BFjQ\nQH/1bf3o5wtmkJHwzZudpNuhBwJweliEFaFrOliLjvVWmeTuW/XbEH3Awmxl\n0heeDfRzntgSaHCRqs52ESBdOMvtf1y6xVuh4NnmI/851KYcWHsXwTHkR4FI\nIODIf7SWRUO+pUXPWyKLf4q9+70NNv+FUvL0DS5UYHnIN4ihWWO6yzZJXZL7\nZZUe+jHH+k+ly/6HaDCRRiBqvS9yOjS8vFz8uTApwmtxRmACDxxHaX/+m2tT\nbDg/\r\n=Fl/Q\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQKHCsFChzk8g0I4z2q9k4vBgyNpEuEuBuVmk3sE4QXQIgZ7veEXtOhQb3r8y8+ok9Lg59UTIS3EtUWDXuCGsMQro="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.6_1631095330217_0.812573929618648"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.7-rc.1":{"name":"ipfs-message-port-client","version":"0.8.7-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test":"echo 'Only interface tests live here'","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","coverage":"npx nyc -r html npm run test:node -- --bail","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2-rc.8+3a8f1fb7","ipfs-message-port-protocol":"^0.9.3-rc.8+3a8f1fb7","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3-rc.8+3a8f1fb7","ipfs-core":"^0.10.7-rc.1+3a8f1fb7","ipfs-message-port-server":"^0.9.3-rc.8+3a8f1fb7","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"3a8f1fb75cd49c882d013ebc1ff600a9815f997c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.7-rc.1","_nodeVersion":"16.9.1","_npmVersion":"lerna/4.0.0/node@v16.9.1+x64 (linux)","dist":{"integrity":"sha512-tQgzyRX0hztO1GtdckVJ+uzb/xB/RnijEqOPMIY/3/JnuKePEjn4EOvEG59r3F/5zL4RRvc0v+ewv0wdtlG2rw==","shasum":"62b6a3676985b4b566549b517eb10b6a097a9489","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.7-rc.1.tgz","fileCount":36,"unpackedSize":147736,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhQKZLCRA9TVsSAnZWagAAeAEP/Rkz0jjIiDgXKzy4T7uC\n8VE2x3G2b60KeV5dK+Ud9MVh5s8g2cybdyasuC0p7JOF1hIqVTcFBfhjJRge\nVeLrSVQxwcqnBoB8Q9A7qlsm3T8V2MkMcmj5YoHV7s1k2j2TJ5eQY1rg6CMe\nE4WTS82dv60+HCVhVwg/Cd/EILs7hvH96uYCQ2IaC+32Fscz/tap5vF4miZn\nb54mCQI4TcWzE1lIWr2FqJg8Hf8dc6BnWevthr3W+h2Q0MSq4mn6XDztPDTt\nzK3IvbLLAn/c1HQMzTnE6bf6JZ/HTnTCFk3O13MHNjaTR0WzYykgvHF2X8Og\nBgG9ZxsFNTrYmNPRRU2E7slRdKOGR88QgFP0rOhgu+5qF4iCSsI6Uqq6xJAs\nRgxSjaKj1ZI340nb4km10dMLbheRJ/wC63umsokAOJlE7JqIxoNEojzqezFe\nyUcDh3TgDwYQda+yvuhRONM0ec6I9Y26vGEBijW/6m52KXR+RB2iDMuccGRU\n9vDIrwxepH0bjNy26y1CMQj6eVU8BnrMwtMtp++L6lP0Zc+dCBc+UG3gqk4a\nhRIX2567+4d0G9MYV82dyX/xTmh7y86lJWqZ/mlUVjqCpuxtp3SSKuLcmB3j\n3jHK5u2X40SUyrrwsVzVGm4AZaYeKmNP+Ji3aUI2pVmsm30zbJ4KFprxY62n\nl4Ah\r\n=Se4B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGnzkCoCWDu1fTcHWZR0oklICUJYCn0HsavMHmUKq5ZAIhAJgRczFaREHlz55oC/rzoFYPyJ/IMmsfIxOJzw1mTotW"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.7-rc.1_1631626827219_0.3525738591955738"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.7-rc.4":{"name":"ipfs-message-port-client","version":"0.8.7-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2-rc.11+d4b4fd24","ipfs-message-port-protocol":"^0.9.3-rc.11+d4b4fd24","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3-rc.11+d4b4fd24","ipfs-core":"^0.10.7-rc.4+d4b4fd24","ipfs-message-port-server":"^0.9.3-rc.11+d4b4fd24","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"d4b4fd24ccb37ba7bf7d587308929bc4843398ba","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.7-rc.4","_nodeVersion":"16.9.1","_npmVersion":"lerna/4.0.0/node@v16.9.1+x64 (linux)","dist":{"integrity":"sha512-uJv2LoXyLOVbEiBObICeA/pis0GqMdAAQTq5uBMuaKRamWRJqXcLtVYlidYfQjKbmTDcGpikskgigxtnY4OIYQ==","shasum":"5b4d409429df646353fe17b232bee0bf5d3845a4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.7-rc.4.tgz","fileCount":36,"unpackedSize":147624,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB1Ry26Xt7zlthlo0TKHI8iJ8cDMkA+LOH1Mu7xQIma8AiEAqETr7gGv2Sfmg6TNLTYjZyQwysPbX3Uy57LeTW4GnTQ="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.7-rc.4_1631883056915_0.18894823788614334"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.7":{"name":"ipfs-message-port-client","version":"0.8.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.2","ipfs-message-port-protocol":"^0.9.3","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.3","ipfs-core":"^0.10.7","ipfs-message-port-server":"^0.9.3","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"88c9921362ea5d71f7a3af67d30765c175783b5a","_id":"ipfs-message-port-client@0.8.7","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-nD8yUXqemDebBskiuMbVOlFLXX7443VP67bVBPMjX3oImj18YLo9oc/ZRmMfNDKSWtWJAChGdt6KxK8vL3JUmw==","shasum":"5651a99ce177ff5d4ae066dee5e27cfb2e96c2ae","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.7.tgz","fileCount":36,"unpackedSize":147536,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXjKjIXSA9+CTy7P9RXQlHzoSNvSU2hvlZqHr6SWY/AgIgYgTCciOsm1vAU05uiH12B3Vht3bGBxHL0xLqFDEaRbI="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.7_1631885047661_0.978558063202271"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.8-rc.0":{"name":"ipfs-message-port-client","version":"0.8.8-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.3-rc.0+88c99213","ipfs-message-port-protocol":"^0.9.4-rc.0+88c99213","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.4-rc.0+88c99213","ipfs-core":"^0.10.8-rc.0+88c99213","ipfs-message-port-server":"^0.9.4-rc.0+88c99213","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"88c9921362ea5d71f7a3af67d30765c175783b5a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.8-rc.0","_nodeVersion":"16.9.1","_npmVersion":"lerna/4.0.0/node@v16.9.1+x64 (linux)","dist":{"integrity":"sha512-jfYZ8e8GIM+Ry2o/UHFWQzt6pZ4MmfmDXvRoFIxxAyBuvXlNsQigeYBump3qednILncSwPakXWHRu+Gq9j969g==","shasum":"c95b57b8937055be322966d77dca2b8e32654fe2","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.8-rc.0.tgz","fileCount":36,"unpackedSize":147620,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAx8hDY1KnfabZcQ9SdjypQU4cF8MAxhqd1CSkOqX2uHAiEA9vCVjTi2rESDXzKoMUSNC4svU1HuWvhv19uBKGTgi6w="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.8-rc.0_1631885417804_0.4719335038767316"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.0":{"name":"ipfs-message-port-client","version":"0.8.9-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.0+a49a89dc","ipfs-message-port-protocol":"^0.9.5-rc.0+a49a89dc","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.5-rc.0+a49a89dc","ipfs-core":"^0.10.9-rc.0+a49a89dc","ipfs-message-port-server":"^0.9.5-rc.0+a49a89dc","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"a49a89dca7d9b81d390af0833bcee2133959d1de","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.0","_nodeVersion":"16.9.1","_npmVersion":"lerna/4.0.0/node@v16.9.1+x64 (linux)","dist":{"integrity":"sha512-UIPzBtTFEb1pHHjotfrMFAIlCiC7PaklEZ/i37c3SZ7Z91FIEDo3FEkACWklYgzq//koqhESfM93mFEIEyn0Ag==","shasum":"78b4d0e9ddb19ad5fb765f379bf8fcda66f7bd86","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.0.tgz","fileCount":36,"unpackedSize":147620,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBUiXVSWkaPAKEOXT/ODMKa3YvhpzbTAZE9FumAkiRMpAiAn1DWFgu3hmC+8nR0ANRe5GLg9yGEgRJB7Pq2UfqUpqw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.0_1631895936717_0.30317214515918467"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.8":{"name":"ipfs-message-port-client","version":"0.8.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.3","ipfs-message-port-protocol":"^0.9.4","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.4","ipfs-core":"^0.10.8","ipfs-message-port-server":"^0.9.4","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b5488cb3ef5ab7ea24b8b2275ffa8cfa4b7b7ed1","_id":"ipfs-message-port-client@0.8.8","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-CI1rxNneIsnQZPeKNKz+sx0Gs/ztf7hlXQRlSgNiPaw5XeXK6YlxqjC7eN/jCgqxUjyg8jjNwY63rDGpIYENVA==","shasum":"ab8239d1650f8e3a58bcecc1e45f5389b1f0948a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.8.tgz","fileCount":36,"unpackedSize":147536,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHOV32qeE+StyD2OtRyCrGaapEmo55JrJmxJkGl4NISYAiEA5k9VrqPM93vLZm/7lfG1snfgRxCYFeEe2JxqPvnlb48="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.8_1631896566998_0.1671408973471027"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.1":{"name":"ipfs-message-port-client","version":"0.8.9-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"src/index.js","types":"dist/src/index.d.ts","browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.1+4126a5a3","ipfs-message-port-protocol":"^0.9.5-rc.1+4126a5a3","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.0.3","interface-ipfs-core":"^0.150.5-rc.1+4126a5a3","ipfs-core":"^0.10.9-rc.1+4126a5a3","ipfs-message-port-server":"^0.9.5-rc.1+4126a5a3","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"4126a5a38bd7b42e96171b67e9cbcbf4efb94476","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nconst IPFSClient = require('ipfs-message-port-client')\n\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.1","_nodeVersion":"16.9.1","_npmVersion":"lerna/4.0.0/node@v16.9.1+x64 (linux)","dist":{"integrity":"sha512-VYRH9FBcFj1f5R6X9Kx3XqjIpJ8Wszml6WPGPHILyWPtYWFKxgB5i6fY8hbaaNfHOOjEddIquQ9NkmgVIqzXhw==","shasum":"8c39a9ace963990677e63fc668545fcc1f0d96a9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.1.tgz","fileCount":36,"unpackedSize":147620,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHGefX4mY86rZwcNmcQIcZrxUTikSfmKxSJb64TMOrISAiEA/wkKhL9mxRYRR8azXGOH8Mw2B18sFpvM5vDefut8u80="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.1_1632240650716_0.8878761722795485"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.12":{"name":"ipfs-message-port-client","version":"0.8.9-rc.12","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.12+98e3c7213","ipfs-message-port-protocol":"^0.9.5-rc.12+98e3c7213","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.150.5-rc.12+98e3c7213","ipfs-core":"^0.10.9-rc.12+98e3c7213","ipfs-message-port-server":"^0.9.5-rc.12+98e3c7213","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"98e3c72136abd56bb6e3a8ee1421f7dcc8c8533c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.12","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-01Hia7kYyUuj+2JT8WKkXc2sZOavR/2U3jl5ZMI+dWN67XFAu2vL1S1Pe+MqCsZQtgH6/XljATE5uAqPvauZoA==","shasum":"f15ed6394f69ab267a7c781da9f199ca559eee8c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.12.tgz","fileCount":49,"unpackedSize":149161,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGZkZKKniIoJnoeVck32X4MOd1bIK/JD91pLEVhQ9yUlAiBUMpYP9gi+BHKePhaXXnDbAOLgvL8ybHC5Z102XLEymw=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.12_1632377781429_0.538599515093771"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.14":{"name":"ipfs-message-port-client","version":"0.8.9-rc.14","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.14+498d9b0f","ipfs-message-port-protocol":"^0.9.5-rc.14+498d9b0f","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.150.5-rc.14+498d9b0f","ipfs-core":"^0.10.9-rc.14+498d9b0f","ipfs-message-port-server":"^0.9.5-rc.14+498d9b0f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"498d9b0f3c5325af2d2f93ce1538c65f7c1eb2dd","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.14","_nodeVersion":"16.9.1","_npmVersion":"lerna/4.0.0/node@v16.9.1+x64 (linux)","dist":{"integrity":"sha512-fcAaasqtH75pujPlNB++ZwKEbm4ZPnn6/YN+EjAX5ULk99PcgOtGxRe2CUk+UcoJpKAVfUlzHRV4zQkqhVIDDw==","shasum":"8aa79b61e1933b769478d18440ad4fe93b6d9383","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.14.tgz","fileCount":49,"unpackedSize":149044,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICx2Wn41FVRRCTcPmOi6Zn4TPun5mpamMrS5N18rUmIfAiA4npb9lsxf8MRfhgO1m1U6kzkUV9+Uzty79SAeUQdyNQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.14_1632394076753_0.2256132967973823"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.15":{"name":"ipfs-message-port-client","version":"0.8.9-rc.15","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.15+5de1b13b","ipfs-message-port-protocol":"^0.9.5-rc.15+5de1b13b","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.150.5-rc.15+5de1b13b","ipfs-core":"^0.10.9-rc.15+5de1b13b","ipfs-message-port-server":"^0.9.5-rc.15+5de1b13b","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"5de1b13bb685405ae081a824dd76e34228724451","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.15","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-zsrWZ0ZQaBuJL23/Na934ynHFvFZiQgF+md5/7oVFFZuq2f6DBgbS4J2B7WzNzMXoEEKMcQ8TUkEcWZFk6Prvg==","shasum":"ddde47fe4a66c27c072ec766560c7315a4ed8529","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.15.tgz","fileCount":49,"unpackedSize":149044,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDXb8gRGCVEjv8LLOWK0cB85bvbUpxsKcGwrNzw6DzwFwIhAMHOjar/NP0Uj8wn60/KXpU/zL89VGTpDGiuOXy05/A2"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.15_1632401814163_0.8296929866766385"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.16":{"name":"ipfs-message-port-client","version":"0.8.9-rc.16","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.16+be4a5428","ipfs-message-port-protocol":"^0.9.5-rc.16+be4a5428","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.150.5-rc.16+be4a5428","ipfs-core":"^0.10.9-rc.16+be4a5428","ipfs-message-port-server":"^0.9.5-rc.16+be4a5428","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"be4a5428ebc4b05a2edd9a91bf9df6416c1a8c2b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.16","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-eDiISFrM/0idJ0n5aF8MgrCvlp+x3hwu1Ggv7dRNDZJivJNi07RzwO9qwX8qwLNTNpzWP/VopZ86LdOc0IqVIQ==","shasum":"ffafbfaef86477d447f888fde97fba21324aecce","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.16.tgz","fileCount":49,"unpackedSize":149044,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIElH59nwZbum7TRFDfx8dFUqCL+YOnjRMU1FWPOgQcGUAiAke11nMl6+EyvjEgWW8CTsowDiHxiFhoftNetPxzLsbQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.16_1632421996885_0.18692158623915334"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.17":{"name":"ipfs-message-port-client","version":"0.8.9-rc.17","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.17+b0f367d6","ipfs-message-port-protocol":"^0.9.5-rc.17+b0f367d6","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.150.5-rc.17+b0f367d6","ipfs-core":"^0.10.9-rc.17+b0f367d6","ipfs-message-port-server":"^0.9.5-rc.17+b0f367d6","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b0f367d666aceb4ea8bdd532a9d8c3501f8cc78d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.17","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-8TvArKHoGwvSBgl0gelyzqzbqVkMUiEISe0Tvja90S0NRxGWPr7r/mf8KFaBHD8qGy7jrdskhLUQqvw80ZC99g==","shasum":"a653eda49f5a27dd1f2d7a4887f8f6e40c8da650","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.17.tgz","fileCount":49,"unpackedSize":149044,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3eadoJDmOF8Exbf6bO+e9TWkCXyIYYOdLGZWSg5vFFAIgZlb4GvW6SJmSFinRC7XvZo/HXztbmm4FZEPzioAb4hU="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.17_1632482448460_0.8791228446150197"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.8.9-rc.18":{"name":"ipfs-message-port-client","version":"0.8.9-rc.18","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.7.4-rc.18+938a7d72","ipfs-message-port-protocol":"^0.9.5-rc.18+938a7d72","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.150.5-rc.18+938a7d72","ipfs-core":"^0.10.9-rc.18+938a7d72","ipfs-message-port-server":"^0.9.5-rc.18+938a7d72","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"938a7d72896bf5e5afb2ce6d472aec4fa4929a3d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.8.9-rc.18","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-5rJiUxbkH7n9YmOoAMri6sJaZQV5DitFRAGumJ4SrBjURuSa6AjQAmgM8kviehkH6cN8MhhVAvTp7QzA1BeEsg==","shasum":"f64b975e779c16162590c7ae4b00ad0b7b7823af","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.8.9-rc.18.tgz","fileCount":49,"unpackedSize":149044,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGob1fEyaPccR1B4u2f3XfZgYNcAH2s/Is6AaROf0h0oAiEAoLEyu1SNx444fV4EdIqQB4rMrMSDQCpKCH8L/kT+N8I="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.8.9-rc.18_1632487537548_0.47193681256005493"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.0":{"name":"ipfs-message-port-client","version":"0.9.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.0","ipfs-message-port-protocol":"^0.10.0","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.151.0","ipfs-core":"^0.11.0","ipfs-message-port-server":"^0.10.0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"cbd3e948deb5a6489cd69d1705a0261860c2ea22","_id":"ipfs-message-port-client@0.9.0","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-2bL+9QnM9MKGbAjY5yFrHvYimAJ35FjWRl+nC+mimxJWCYbmlEC44MA8vW87ZMX891TxVbvMQsUyll1hkHzhqg==","shasum":"ffbb3584fd06fe84654941181f0538303a6082ff","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.0.tgz","fileCount":49,"unpackedSize":148956,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHD2KTrUC8Q3yw84HUgTaom08krqKKXSmSf4LgrNjInVAiEArAn4E47G90WNNqqJY9m4zZfhYt3zT+kEb9BjOIdO54o="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.0_1632487764479_0.34950945405210065"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.1-rc.0":{"name":"ipfs-message-port-client","version":"0.9.1-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.1-rc.0+cbd3e948","ipfs-message-port-protocol":"^0.10.1-rc.0+cbd3e948","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.151.1-rc.0+cbd3e948","ipfs-core":"^0.11.1-rc.0+cbd3e948","ipfs-message-port-server":"^0.10.1-rc.0+cbd3e948","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"cbd3e948deb5a6489cd69d1705a0261860c2ea22","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.1-rc.0","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-Ye/FLtBhs6s4Qh4WsW+FpgNITkDX4cp8FACumtbRays9t3qSqndXhmPk27kU07H9g5INHcl3oA/2sN4csyl9bg==","shasum":"ccc6fe780b6ff40e2d32da8676463169ad130836","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.1-rc.0.tgz","fileCount":49,"unpackedSize":149040,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCqIcWjcJWWjJLgGFYKl3KXSH1uZoYIUf7//UVldTAwigIgdHLXWCrSpsQepn8Y+EBD3jQ4VkmQdGnkcCfa4QS0yh4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.1-rc.0_1632488020576_0.3264445317472542"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.1-rc.1":{"name":"ipfs-message-port-client","version":"0.9.1-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.1-rc.1+a0e36f40","ipfs-message-port-protocol":"^0.10.1-rc.1+a0e36f40","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.151.1-rc.1+a0e36f40","ipfs-core":"^0.11.1-rc.1+a0e36f40","ipfs-message-port-server":"^0.10.1-rc.1+a0e36f40","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"a0e36f408135c963d4fe3a66ccbe94e60ae5d8c7","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.1-rc.1","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-LGmnx2726iAp2+tjtrubO7xav5YYV/j3wGx9YoOrknSwc5PMz2hOu5hiisP4tGoA0w3GO+UvBnPo86D/jZvP8w==","shasum":"0a868fa04e40f3572a748391919bf37f7fe3a2e0","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.1-rc.1.tgz","fileCount":49,"unpackedSize":149040,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC5GR2zrkQLnnXjB952TE2KUmb615slZlSrzYopzDOoSAiEA7agYD2lpgtQgkyn75+Rl2j/uv9kRNNzovQSwiYG+X0o="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.1-rc.1_1632590775694_0.3055668057145122"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.1-rc.2":{"name":"ipfs-message-port-client","version":"0.9.1-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.1-rc.2+78060914","ipfs-message-port-protocol":"^0.10.1-rc.2+78060914","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.151.1-rc.2+78060914","ipfs-core":"^0.11.1-rc.2+78060914","ipfs-message-port-server":"^0.10.1-rc.2+78060914","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"78060914410f54f443aad4c5c0de39f899ec6f40","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.1-rc.2","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-VB1tCn4Ofj1Iw9/mAHP53M9EeAkK3yd/+7A5ZJtUaTDL38k2NPdO7K96kr0lmM8R2SGA6nRUzi/G19kmCS2Vlg==","shasum":"15f70cb923b7049cc9a4d5193c539c56acd37f7f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.1-rc.2.tgz","fileCount":49,"unpackedSize":149040,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf2ThhVBa10U5lmPgHWk6+FMihvwMNwBwPbGdMUEmM1QIgK4P2eIE9LK1ESu2WQvsFwjglKeYS0gysbkYOQMZYOzs="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.1-rc.2_1632593471828_0.3993321530250893"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.1-rc.3":{"name":"ipfs-message-port-client","version":"0.9.1-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.1-rc.3+7cb98616","ipfs-message-port-protocol":"^0.10.1-rc.3+7cb98616","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.0","interface-ipfs-core":"^0.151.1-rc.3+7cb98616","ipfs-core":"^0.11.1-rc.3+7cb98616","ipfs-message-port-server":"^0.10.1-rc.3+7cb98616","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7cb986167d2e51ab0ce94104bac92ec63c0a7cff","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.1-rc.3","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-q01IquApoep0sKThoOddOGjrhavvRJwKs11H+F9p3qnVXchz48gQh16PC20KyES5uQMAfkQaHIewwDxzGW442g==","shasum":"2b72a9ea191be16a95a4c895641cc3b6e98d37f9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.1-rc.3.tgz","fileCount":49,"unpackedSize":149040,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAGuFpfjH551h0DQtnJc2/UrqHCg2xpLZgOCVSyCvHTyAiEApjTj7lQT7pecE6LtO6wQtXluVYhmgDtdCLXWY1QLwYU="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.1-rc.3_1632760651742_0.2820681067994433"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.1-rc.5":{"name":"ipfs-message-port-client","version":"0.9.1-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.1-rc.5+4dd8acf4","ipfs-message-port-protocol":"^0.10.1-rc.5+4dd8acf4","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.1-rc.5+4dd8acf4","ipfs-core":"^0.11.1-rc.5+4dd8acf4","ipfs-message-port-server":"^0.10.1-rc.5+4dd8acf4","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"4dd8acf4d7df0ece0afa764d44dbdfbf788807e2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.1-rc.5","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-kj6y+jqNKbZrViYl9R8FZ4SIhl63n5vMmok/qfqBF4ymSCOyUpYFhz20p+WGdZurBNWZ7PTu4G55C5YekGyM3g==","shasum":"f4eb8bcd01dc67711209c808c19c42aa45faafe7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.1-rc.5.tgz","fileCount":49,"unpackedSize":149040,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzpP1dF4dfAsbD4quOx4m6JSRfaOOa3VovRDSr5Zn/uQIhAPLDUE7aqFzovEzmcVx4/EF/pfWzHevq17Zgwoo0Hr3D"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.1-rc.5_1632830415574_0.12579795904067703"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.1":{"name":"ipfs-message-port-client","version":"0.9.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.1","ipfs-message-port-protocol":"^0.10.1","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.1","ipfs-core":"^0.11.1","ipfs-message-port-server":"^0.10.1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"5ddd0c555cc6577ee15667f4ef4e7f3a3b17d04c","_id":"ipfs-message-port-client@0.9.1","_nodeVersion":"16.8.0","_npmVersion":"lerna/4.0.0/node@v16.8.0+x64 (darwin)","dist":{"integrity":"sha512-++9/uIm5Wf3bxNKNKd1PogapCCxkrFEJoG2f1rMP9sZyfb7Rj7T7LkeIuvZ7os1AGg4nZ3lg3wIET9YQH2D9kQ==","shasum":"31a2020cfeb9cb64ed44bba8961829e24bb4024d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.1.tgz","fileCount":49,"unpackedSize":149067,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHhcCbmdUbd5dXC/wC1xOboqnBtNxK+7eWjfuRWP7qWUAiBLXOu7Dw8KwHlSvR1//BJlokeB1IP7nAcQjS3nuUfKOA=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.1_1632830586083_0.4392524729016758"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.0":{"name":"ipfs-message-port-client","version":"0.9.2-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","ipfs-core-types":"^0.8.2-rc.0+5ddd0c55","ipfs-message-port-protocol":"^0.10.2-rc.0+5ddd0c55","ipfs-unixfs":"^6.0.3","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.0+5ddd0c55","ipfs-core":"^0.11.2-rc.0+5ddd0c55","ipfs-message-port-server":"^0.10.2-rc.0+5ddd0c55","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"5ddd0c555cc6577ee15667f4ef4e7f3a3b17d04c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.0","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-pSWMQP7YEo0QFLP3uz0TWAI4+giYi+M39U0Jnn34ASvwmIgJ47N0QED75ZR+5UH7epy0Ys/WSe3VTvkTK3ddOQ==","shasum":"e0e1f22b7cad636e3f93b9426bdb76fde1903c57","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.0.tgz","fileCount":49,"unpackedSize":149040,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPbYsEITJGtTH434qNrJbCD7BKUFkjQ4CDQaFkKxtMugIhANx2taT63C8jenT1GWwpSe7FdGSY9/xg5bx18aA5SCYU"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.0_1632830862158_0.8539501634741475"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.1":{"name":"ipfs-message-port-client","version":"0.9.2-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2-rc.1+3ce2f769","ipfs-message-port-protocol":"^0.10.2-rc.1+3ce2f769","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.1+3ce2f769","ipfs-core":"^0.11.2-rc.1+3ce2f769","ipfs-message-port-server":"^0.10.2-rc.1+3ce2f769","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"3ce2f7693b59ad4176e245c4c7e75a91dd1bf94f","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.1","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-pDO5SlAYL1+AP8Z9YdX6TpwlFdnxAo/r5moJ+6FIZdCp2yRYLO1193XWPKd0K5pFurREY7Tgcj/EHIS7ro83Vw==","shasum":"29640588146b34d8c5eaa775d53c1b3427c56531","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.1.tgz","fileCount":49,"unpackedSize":151988,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEAyXNuJyyLJkqjWwQj39M8keKs5j9HLIA77BMt6AU+KAiEAsyGFGIQ5uQ34Vj3w2sOlv2olUQqHFdxrzv56b3OufPA="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.1_1633016934267_0.044002069921013076"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.2":{"name":"ipfs-message-port-client","version":"0.9.2-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2-rc.2+b09a18cd","ipfs-message-port-protocol":"^0.10.2-rc.2+b09a18cd","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.2+b09a18cd","ipfs-core":"^0.11.2-rc.2+b09a18cd","ipfs-message-port-server":"^0.10.2-rc.2+b09a18cd","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b09a18cd98883662353d116a8ff25a3ddaa48fc2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.2","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-WblsL/2Zzt65ZxA8Rtu+mhvELi3CcMhBA4BH9CFIsKVzvVivt9sqt0nYPUI7FP1vAwwQxbGOrjqjThSowmGenw==","shasum":"d3f59d35023e3ec5e03fe93bb03d62963de190d1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.2.tgz","fileCount":49,"unpackedSize":152005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCA6CcF1EZPKxLbskJhqVLrsFmubJjUGax9ly190X24+QIgSxNtjTfnm8dcavoYoMdwQ7I6rqjzwd27IClfNT7A688="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.2_1633023554493_0.3205359261771825"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.3":{"name":"ipfs-message-port-client","version":"0.9.2-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2-rc.3+bb0dd96b","ipfs-message-port-protocol":"^0.10.2-rc.3+bb0dd96b","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.3+bb0dd96b","ipfs-core":"^0.11.2-rc.3+bb0dd96b","ipfs-message-port-server":"^0.10.2-rc.3+bb0dd96b","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"bb0dd96be3e570f5a43a4f31f43d1c97e8322605","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.3","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-uPM8w025NWK+AVca1RCAzMRo7PRnLwrHcgn+eP9plB6da0oe1TODox9+tvdhjuntLR/+Li49X3A8j+N0j0/QOA==","shasum":"541c01efba17c14f4acaac93eae253f1d044f8f4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.3.tgz","fileCount":49,"unpackedSize":152005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgLp8bxJzDlilhj/Nh39JUVxhnbEBxMe4QTIFdArhOJQIhALE5J5Fz1r0WFbdUkFfvwu/XOy02Y7Y8QkMCLJ6CcY6L"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.3_1633179496373_0.23772725933595162"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.4":{"name":"ipfs-message-port-client","version":"0.9.2-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2-rc.4+09c7bf7b","ipfs-message-port-protocol":"^0.10.2-rc.4+09c7bf7b","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.4+09c7bf7b","ipfs-core":"^0.11.2-rc.4+09c7bf7b","ipfs-message-port-server":"^0.10.2-rc.4+09c7bf7b","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"09c7bf7b63620f84d50c8a3983a5d4c28410cd82","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.4","_nodeVersion":"16.10.0","_npmVersion":"lerna/4.0.0/node@v16.10.0+x64 (linux)","dist":{"integrity":"sha512-tgPU3WBiCujCXcon2CZGq5kPpU6FXQM7GrpAV3pSmAJBgRxYyYqcX1EqskjX69pxgjkQLCZtS3aGo1N2Wdfv6A==","shasum":"deaa30f6440cfc921b2baddec5b3d527dafee187","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.4.tgz","fileCount":49,"unpackedSize":152005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+YmMt4sryJm3q8UBx0K98gvtwPXEC45F8aJOrhyLWIAIhAJNNZZfZchR0+vN7p7KeRIdmrVfRjkRX9G4MYs4aGw/u"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.4_1633703583270_0.5729812114906123"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.5":{"name":"ipfs-message-port-client","version":"0.9.2-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2-rc.5+15184bf1","ipfs-message-port-protocol":"^0.10.2-rc.5+15184bf1","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.5+15184bf1","ipfs-core":"^0.11.2-rc.5+15184bf1","ipfs-message-port-server":"^0.10.2-rc.5+15184bf1","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"15184bf1838956a44c079660a4d82c24166407db","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.5","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-IQyAYlngVcPM1QkItrwGuc2rnJJEzBiDtMEv+OTdP+CMLCBzVKPmvCoc1c3ZSORAUxyXiDF1sAcvfgd/ah875w==","shasum":"8128310f74ebf8b6c33548dcd8bf5b797865b70e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.5.tgz","fileCount":49,"unpackedSize":152005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDvMVNt7k+YQkT+ZLH8bFdgJCT82WbI96b/8IIgh+uq6wIgGeAUPnGwKGJ6Zd/NiVMi+kZxVuWAtxU5OxYk3mb182Y="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.5_1636010779705_0.9394839275388278"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.9.2-rc.6":{"name":"ipfs-message-port-client","version":"0.9.2-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2-rc.6+8a3ed195","ipfs-message-port-protocol":"^0.10.2-rc.6+8a3ed195","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.151.2-rc.6+8a3ed195","ipfs-core":"^0.11.2-rc.6+8a3ed195","ipfs-message-port-server":"^0.10.2-rc.6+8a3ed195","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"8a3ed19575beaafe5dfd3bce310a548950c148d0","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.9.2-rc.6","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-yNWx6yXUN9OuYvCZMXvvCSCkyofjAZpBHDP5qrjbsznwBG3LavdXlWKnw4ou090zB8W0tmmq3UFIejLUYewa0A==","shasum":"5413813f0349234bfaf3dd844661b27b8614ed1c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.9.2-rc.6.tgz","fileCount":49,"unpackedSize":152005,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1bTdFKhtZT6fSYKA2GjJ8oJAv9h8Zh7Oq352aq+5f/QIhAKVnuTdNr3Yrj4YDJ/0p2bsn3E6OEAN0JkWsQD2dF8DW"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.9.2-rc.6_1636716674662_0.9602750204269295"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.0":{"name":"ipfs-message-port-client","version":"0.10.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.2","ipfs-message-port-protocol":"^0.10.2","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.0","ipfs-core":"^0.12.0","ipfs-message-port-server":"^0.10.2","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"568aeadd8f308cc230de06a956c1a9e6102094b6","_id":"ipfs-message-port-client@0.10.0","_nodeVersion":"16.11.1","_npmVersion":"lerna/4.0.0/node@v16.11.1+x64 (darwin)","dist":{"integrity":"sha512-oVcZVlG44288LHDeyTaAxbVt9NS9LPjj8o6RSwBjHMNvw9epGstbK+7yl39978r6sj7dAoWTQg+NRqheVAQw2w==","shasum":"2043e645a511b44ceed5b80294c3ce1821e53bb9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.0.tgz","fileCount":49,"unpackedSize":151922,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICNKxuMEBu9vuyLlIcqJPYnJacpFJIzt5u6oi92z0q2RAiBWlQAIkzp+7v8o3iSUsrCAExVsKd3+H+hnjD/0h45fiw=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.0_1636718068552_0.8505101696312314"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.1-rc.0":{"name":"ipfs-message-port-client","version":"0.10.1-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.3-rc.0+568aeadd","ipfs-message-port-protocol":"^0.10.3-rc.0+568aeadd","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.1-rc.0+568aeadd","ipfs-core":"^0.12.1-rc.0+568aeadd","ipfs-message-port-server":"^0.10.3-rc.0+568aeadd","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"568aeadd8f308cc230de06a956c1a9e6102094b6","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.1-rc.0","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-mjxP7lyQC7XfBzXJgC+h0EKu2XLJzagdsIeAi6MQBL0ptdH4Hman9ligyxdBopy5YcEPor3rJYnsB8E1EdL+Rg==","shasum":"8ababa50674d2558153aba74ba8a51579661d7f6","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.1-rc.0.tgz","fileCount":49,"unpackedSize":152006,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAok2mdtDN0vtSOyFevdnS3YZcL106r7bhPNEpZGCxdtAiEAhdsogpvsJg5pPvEfusYJ47+6pNbcufRtmeiVl+x4uY4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.1-rc.0_1636718168894_0.6949532020785216"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.1-rc.1":{"name":"ipfs-message-port-client","version":"0.10.1-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.3-rc.1+f419553b","ipfs-message-port-protocol":"^0.10.3-rc.1+f419553b","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.1-rc.1+f419553b","ipfs-core":"^0.12.1-rc.1+f419553b","ipfs-message-port-server":"^0.10.3-rc.1+f419553b","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"f419553b9dccc0a1172f399c41b766a754a3ac56","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.1-rc.1","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-QV6x1EHAms0DhYqNB3qswduj9y1z07vIpBLlE4weg2DKc9PV55iM5hHidfDO1unt8nYK0T/jNTGg5gkF7wnY5A==","shasum":"185f06bfd5fbacb765ec38afa03959655800dcb8","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.1-rc.1.tgz","fileCount":49,"unpackedSize":152006,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhl8XYCRA9TVsSAnZWagAA3/wQAI5hyQOcHFMXdBRFujvY\nwnL3otpwpuhCb3fgtfjpEgaizn2jofDJbMEk5A2oxFzgpIYhUgUPOkCbdNIH\nNhWthIDXQBYIhnutFKfmUlB1QdGRdKRGbRL493JuPEwEyUdCT+JKJw8leYE6\nwmBphuHGkTTS/08GyUddJJLhV7B1IVX2r08xzwfGZz7wmbmhx/o67sFfIx2T\njLUEFTWDD9eO0DoduPx2dZHsr/kb1BQdc3dazPQQFEXNEkEZpdpQG6VZtBTw\nHLocFv9vyRgdseZJ3bHSmy3g36eoI7v2Q39ZEoyNByqaD5rFVZMgO3i1edSi\nY1EhTIxJpQAz5FM22rLPZw1BvypFEbtq13TvIAPWyLfuhqsd3c4YNzMqkir5\nVjJNaPmsUI5HCfD7m/YC/aLg3vrE7QrfmvgsZWp8/BTX+qQiC+ixvEMLWdcH\nCIaNZVT6kvvlE3eMwtPnrty8tIRfibLUnOalS/n1HwsEcdgkyqEsq2eAq4XC\n5+U7KXPIdh1MbY5etWsiSmAxTHNpInr3A2wtwqfiIvkRG3BTA4d3+tRXXey6\nXX5FKFUjDaE1eLrBoI3mJQCKdXAYtMeDi9lskIvlv5irGtJi9u8Q2lwd6HgX\nNoS0nVKzJpn4W2OUozqsoQiYRINmp6PMctPYFuRu9stGTANVMdVdaIldNbK3\nOl+2\r\n=AVxK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBzkH/phkDXqSQlMOWxov6quL8MFZVOi7n5CqBYQ8PixAiBwuWEWnJUxdP4+PmOSIwDht4TFPpXnTRyUrfGCPE6t8g=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.1-rc.1_1637336536464_0.0878120121622532"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.1":{"name":"ipfs-message-port-client","version":"0.10.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.3","ipfs-message-port-protocol":"^0.10.3","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.1","ipfs-core":"^0.12.1","ipfs-message-port-server":"^0.10.3","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"fdc148b5c08c0be49eef77a18259d5baa895e3f9","_id":"ipfs-message-port-client@0.10.1","_nodeVersion":"16.11.1","_npmVersion":"lerna/4.0.0/node@v16.11.1+x64 (darwin)","dist":{"integrity":"sha512-8T07SPV2SIoKCzv1qQl3WhLPH0InL8/C1ghkkfVC5ATsmgLlXHoGpMmjH9qKyXPGTN7tJL0K3JvX/xfLrqrhBw==","shasum":"9d6a3c5a464bdd0b45dad347fd60c0e9ac77ce9d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.1.tgz","fileCount":49,"unpackedSize":151922,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhl8bHCRA9TVsSAnZWagAAamoP/R0vkfjuQf1+C/ymsVeh\nbQ318nelcWE6SALqB1BeeW0V1felPgux9Q7VbH4nBCxw1QYHs3IRjCSnAzUf\niwYT72Z6fcNw1YT3cO27Tgt5sj4YLndfwRBk1wVamyzRWH1Qvnmsrryh03wN\n0uvJImk2T62JIkGRvHCCp7cBD63aAhp+zqKcsAaYZKh8wWQOXzArZSu1RoOK\nSGE+UwANT/S5CpdRgTx2Rnsq/ey4iWEWXvOTvrMVmDv4VrI4jWJ3f82Owf24\nTqq1aVPoYnMjfGPa4mpCXPNd7RCq02BbPXGMbYapGzOWV6x2/CUzUmM5ucDc\n+Hmp32kjM2eequqysVyhPjxRrTOF8gTs5n4gamE/9b3Uox6eTxsIwIl9xcbG\n9AmSha/Z5u7T1kOnwiEFZ7Ya5gnxojq7ZcEaGfWyZ7utQxGPCFJYuPHNySe/\nUmMI2kozukyHZQVkZsH0iYpRuWZOMfW+/z9vKxL0zozPTDG4XttCCyoXGd/7\n4rJdZwrdkNPVBTv+ZRFz9Fozu9p5iCmNNb6DoGZV3nSTHtrAShb10H4M46D5\nAl5sK8EQ+k3FzMC3aitzq2Y/MLL5Z2oQtq9/kCX/9s57DNsOGFLpKK8vBNin\nDsfM1AU8f1ler2dBzQR/dhiK82ATEpLWI8GI8JQAjA/BxiSUfQFiPXRkPvWa\nqKUJ\r\n=EOgw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJ19Y9e0GMqIRAoem4NGSRNNiGRxflRk/gnlp/lnQFuAIgMXpyZzAZSrHYPqjYry6zWcVtfQlJg1QRwX5U1YRlZBo="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.1_1637336775505_0.47296947294907676"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.2-rc.0":{"name":"ipfs-message-port-client","version":"0.10.2-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.4-rc.0+fdc148b5","ipfs-message-port-protocol":"^0.10.4-rc.0+fdc148b5","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.2-rc.0+fdc148b5","ipfs-core":"^0.12.2-rc.0+fdc148b5","ipfs-message-port-server":"^0.10.4-rc.0+fdc148b5","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"fdc148b5c08c0be49eef77a18259d5baa895e3f9","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.2-rc.0","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-E61qs/TrtuDImDo+cqA0+Q3nYqfKRyGzHe0iVFjolaFCzbpCFyJzvFTe//PF8u1QsFWB02RRV+UNrTaphWohMQ==","shasum":"519366a681a677d0f8e952c5b6b976616e776f8e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.2-rc.0.tgz","fileCount":49,"unpackedSize":152006,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhl8dUCRA9TVsSAnZWagAASc0P/0w+SCqPqm+Yulvd9dCu\nTQx7rByE3X5xztaLR8aFp3bUNU0+RV4V9SkGAIstdvOs8RXuHghEm3LTyb/Y\nb+5EaeAY58Q1MefAXUcq4H8tAPvbSmXgkfgRXad/SVyBXz5IQUksV7i34gCK\nd8HE99si86eMaUaIHb8bQkU6papBjAVafC7S9IoPIfl1fFHKpsetEJ4xQClb\nDvUHX75mXRVUR1u3i5kXyai9WWSET3/VWQfhsBFTuFIxPZitPF6bwYaLktp4\nwfXKHitRMqhc/RWS483+pPrSuQXFcJ5QYjwizcomgcHLDHaRZ0GmMUqwTf6l\nvLyjti+n1ndTOXMjxWrgGoSfq+7oNuTRFTYlbkb087uBVjqQc34AW9Avvz5X\nQ/mHLfIXvTZmOfSyJgHq9gZSLLeLBIeZ6Z0ZDON4W1Pi4Z6h96r5yySbgYty\nbuJjl8/SxbEJWwuNJONsBsfYvAkI/7UMdNKzi2PDfYSote367wupa+VL1pf7\nwtHE2R7YjVb+OjFtaBs9rqhiJsTyeQtb6rFKrIbfUkuwpPu+t5BC4H9tx3Je\nIAE/6CbhQxu54jmfAKKaqbxRbYW7XppRdI1+//R1ZxR9XW+6XZf5a4SyWu/C\nAtxQkDrE5i7Cq+0larbp/CJL9F0h5xg0nlHP6R7/PiI8eG8uXW2a6f8p+hx4\ni9cc\r\n=lmER\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbu90e0zvRyK1cODQE+JdF7tSIyWzBKyRxY7tzeTLy/gIge1zZf7fuOAhpPuL4CxkueEWWnV95uWbj24SydaCFumw="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.2-rc.0_1637336916242_0.7683754560333649"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.2-rc.1":{"name":"ipfs-message-port-client","version":"0.10.2-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.4-rc.1+041fc29d","ipfs-message-port-protocol":"^0.10.4-rc.1+041fc29d","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.2-rc.1+041fc29d","ipfs-core":"^0.12.2-rc.1+041fc29d","ipfs-message-port-server":"^0.10.4-rc.1+041fc29d","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"041fc29d151e8727ce9aaafd2c46a4cd34baa8ce","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.2-rc.1","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-So2KMJS+nw7QoY4hl654aBHuebbUuQjPNt/3xW/iIbm/0LJtTNO3Pag+Vo5COGrlQZFtNdki0hksAdHYQQaAPQ==","shasum":"82903f22babf4d24a782689195721042dd814d3f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.2-rc.1.tgz","fileCount":49,"unpackedSize":152006,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCju1ulOr2i1SfDf3J5WicWLadEbejuO79oIPqp9ybvUwIgDuz4fztch17qeq+PI8c5a1TqsaLBiLt6tECKRfOB7Kc="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.2-rc.1_1637342618091_0.021003776874749525"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.2-rc.2":{"name":"ipfs-message-port-client","version":"0.10.2-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.4-rc.2+70c67e27","ipfs-message-port-protocol":"^0.10.4-rc.2+70c67e27","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.1"},"devDependencies":{"aegir":"^35.1.1","interface-ipfs-core":"^0.152.2-rc.2+70c67e27","ipfs-core":"^0.12.2-rc.2+70c67e27","ipfs-message-port-server":"^0.10.4-rc.2+70c67e27","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"70c67e27d0b82c7650a2a0d7a646afdcd24e73c2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.2-rc.2","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-FLN/inCIOyAhv62czmER8fKBozsJ6yml7uaRKU55LYQ0f7bqYL0IgZ3QCWoGaRup4v2zh4S6WRf0Fl50rSQ7ow==","shasum":"a6d1cdd5ec23d5f6fe7ba443e3928c43afba029f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.2-rc.2.tgz","fileCount":49,"unpackedSize":152006,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhm8KXCRA9TVsSAnZWagAAnLMP/jxx068NhT8SmRDiFoqB\n6ttroua4hk6sB+4C+rqcppxobyL7Z1eqFNzYKLd0c0lSkBYg2+anhRDI1bGQ\nBIqL3ApUx8SjXFJrE8Ir0ALhcfjX3wrcp+ipk58Z4MhPuORLtPo3szJ1HAyn\nwv3rJkkou8SUymMMCAgGupw/SxGcaSidJ4QrhNTEYnvUt1TUY+gGKNK8P4c2\n0y34il/vs7v9n3EMFmEhkujJVueER/pODBuehagbblv0s2cGdjzqOJfXp7Ti\n96bUDd8kNVxqKOSxEv3Cfblf3anNFOBfHb50ITGq3JZCor9sU9yfdNWmVrhk\nEdOrZ+WErAaZU3woTda06OSsKYujwL4JyxKg6NaN9uf9hoaHRwzV81ju6cnN\nMtAuVndWYIFjBkCRcpvlODZNS1a3adn/BJigriv4QGL2u0rqKRa1pUqskNIW\n0viDM7Z6ikAVv9+nitAeqbeGVKshrG0qU5Tbh9iPn4nb5G9mCXhfsqduyvKx\n1TbFQ0ES0VaQkj2twqwy0QrS/ulIspzQ0rxUnVOSb7f6O9xip//GugmHdTMv\nxbsMgOBom1ozAarZFIk/T9aWmOB4zfV5C43ixTIlnOjAtBzt6G187dfbTZ5J\npcV5RaSEveGuKeMelJXK/rGq4vjWOqYM8HDX9Vg4Cpdn8RCLEPH+K5YcEFIA\npJRk\r\n=m+Ef\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDWuoMrVKmeVZ7imArmDMFmU0AZNsVkITL0HnW4+9nPLAIhAL8PyeTgBuPlLg3TCAhtlajTOylaJTwNMZlqNQVhg1ry"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.2-rc.2_1637597847727_0.8155077737715482"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.2-rc.3":{"name":"ipfs-message-port-client","version":"0.10.2-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.4-rc.3+484d2559","ipfs-message-port-protocol":"^0.10.4-rc.3+484d2559","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.2-rc.3+484d2559","ipfs-core":"^0.12.2-rc.3+484d2559","ipfs-message-port-server":"^0.10.4-rc.3+484d2559","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"484d2559cfe120f01eb9c5dc728d1f7cfbd89730","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.2-rc.3","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-D/jvlVDdy5k6rzx+sbsFc6FSIrFR5cJBhZ3DCup1pdLIECAVM6+6vfhWq1HCLfiGfKnkPaKcWnDqU3dlhFYAGg==","shasum":"fa17374ded083aff59f10240c098c4b91e9f50e0","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.2-rc.3.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhngd4CRA9TVsSAnZWagAASBgP/0ptubt4Fd5zTetq/vIg\nKt6BZBnPi+7T7duebXijqH7Q4lLXjgxLm/EGMJOCEL/wC9m4T3rBaV27igZV\n2pdRQT8j5Q84/5IbqWyZwmLlMW1pE4FTCQT0iETsykJnRFJ3borWUx8mVw4R\nV04Br/u6lscrt6zsaUn2EGSd4hi7y8AaSchYdNGVyHpmMZDaA4uwG4kXorQf\nC8dZUyW30xRiyp4dAPMfDxTHenmpwNn9ublAP/IJLTVGG+8ydXGuYEls+YbY\nEB+SIPLSOz9hDxnEPep138oxsurHMU8LDwqcCCrFWyLmh63vuaIHipngX5l1\nGjBfzJq4J0Wp01TCtxCZoVIQi7vlq31BHaYv35kkkJRmwPVQBnBodphpixM/\n7K8aTf/80MD+sp0nlUnkVJb1breu1MNpn0HfaJGrMRIX0iXOydsprRosVleG\nutR2C+MDaUxneeAXGAp+7DQnF4Ua9bA7Xht2g1556y5I/N9isQ/CiDjqdgjt\nQMSvXjH2cmWlarbIz8EUQBoB5VUhHQO2/O224x28iLw7SmVawDU2i6fZIvBE\nSLSUyaxoKAKGIYHAb0pdXvtIY4HT4JG+UecR5XaQbuKEDGAInfw7XJeGvAvB\nc2Z6LlJ0TOQKbcEd7ErKB/Ao86Vf+D+pJ+tG0VlltxiDyX/m0bfPcYM+P5de\nEgjt\r\n=rbM3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA8EavDfxKudhEKv436e0hSR+EsXs+YVjZSmu66fluIqAiASi02aokm2NieWpm3poFdzZa9qD8o9uruN+mN7yxx3ng=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.2-rc.3_1637746552007_0.24625638001174832"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.2":{"name":"ipfs-message-port-client","version":"0.10.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.4","ipfs-message-port-protocol":"^0.10.4","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.2","ipfs-core":"^0.12.2","ipfs-message-port-server":"^0.10.4","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6178708aedf5ea86bf537862c08db49f5b8ea20b","_id":"ipfs-message-port-client@0.10.2","_nodeVersion":"16.11.1","_npmVersion":"lerna/4.0.0/node@v16.11.1+x64 (darwin)","dist":{"integrity":"sha512-DZrCDD9I2QT5l/+NSjkwzZ2w6tOLTDqcLMTlr7HQw1vvRM0HUGue9bSUWgoZmZVm2pNcld1/oPZ+KaVwoP9bAQ==","shasum":"936b1421f21105c551eae2f081fda0eda34b7fae","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.2.tgz","fileCount":49,"unpackedSize":151893,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhngf5CRA9TVsSAnZWagAAQxgQAI74RF1yP4IP2sW6qQDN\nkU6pjeZPtn7v0NIrio1I9eSwbgyNBS+vYKX+y3MdYy2Pp746Q2zqIXGOHCkm\naBE06Selafl0VAtB0uXGv70u43p55EWZLonqQSmlalfokFRVw+LJHX06Kqsx\nWeymWPBtpOZnNaF0QkDcFmVnlq9UlWrXTr4jG+IS/GZI1SKLBzWAem1krusW\n9nZEpzoZCTE8zkL9GAR5TjHupZ5/5rNOxCfRMAXr7MJ1jR62edcitDiRgObw\nMkCLEEaejEM8VSyJr/grEkAqYmyukmDnifyhZsYK/S46Imi8ggT05wRB47wV\nUoTwOJa1fGA9rk/v87XwJj++JKEH8qMNLgWR5WFu0oXWrt9G91K0Ap/dKWY2\nWCNmF+/+ohewbhOgkw3h/V2X7CSfNT8lpGBf+/AuH8xyyLxSgOjkobK54b8j\nzLZlRnH0PzzZrjlHZamdjH3wu/DKKv+QzIV0gHP7ZGjdxUBZbienSEknRzWv\n7tvU0NlKPy5wmAFrYhLLJnp6iVdLq+Nut70fNuvvoLK9eS9l5rLMYsg+CsqP\nA4/mgkgFuExa5+Fo82NejwyVLvxiMDFUMhzXQKxxQA3BX3EPuFa0Frmy3jdV\ncaJcI+zakncTqRo8FMKAqcTCIPKQzHeUwrveZrt98aDp+yEfCqCWJ1CSBq/R\n2OzC\r\n=u0Ve\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB2+mx55IwklLqhqS+vxeAHS3MM73uEWc2gDDal/8u7KAiAOPX77gIpu46plLCAEYtAPXkYW9a4jtjvc3HHSEi/4Lg=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.2_1637746680772_0.9588807489469715"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.0":{"name":"ipfs-message-port-client","version":"0.10.3-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.0+6178708a","ipfs-message-port-protocol":"^0.10.5-rc.0+6178708a","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.0+6178708a","ipfs-core":"^0.12.3-rc.0+6178708a","ipfs-message-port-server":"^0.10.5-rc.0+6178708a","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6178708aedf5ea86bf537862c08db49f5b8ea20b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.0","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-ycklyKb1nUxQeqcOM9+PdZ+DTvQG1fT33pj3HY/MY2EwEUqEQaAicd/CRBM4OIyj6+4bgYhuMO1jlHsSTCUDcg==","shasum":"a7d6d4c590a028df50e04ef34d54cf8338c7e201","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.0.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhngheCRA9TVsSAnZWagAAD/kP/0aKRoQ1rF3gTDVT9ixk\n0hIsznoF2kUGo+Rd9FSnkHU938GnG1Jp+zoDNVku8BAGX7NeG/RsmqhSCAKH\nMSUBaZ+nrNThoFWl16xzV6QBEoJ9yGs5QkVyceaYhOr95UP0fDqBxpyBfdAe\nDbAR1VsJ9wuAg4lwkDRHn/G8y73WiPuXlYaQRM6WW3JJhMD7364YCevUEX9v\n/Z+ahth/kV5O4maCc8g9CEeKmi/1p495VL+6QT3uDNQCFplmpakLOMdhSgfx\nDopH5CQB0p9irGiBc/fZUDknnELwUfFZ0bHDt72IV4ZcpL23wQxReLUmm3ar\n0NGiWTAUnafpdguCdirL4lgOPSzcYw/pTv4WaAsHbVKL8BDGC8yWuCMwI7Zk\ncfiHic447k9rJZIQ6F+XlUbn8Ws5GzVloTdSFGTDEGxrmUe1bZNHniju5Tla\nvqWGGSRK5eqzuwlO88zqoTGXHBHj0CtxGp4wjGeIxEPqxYRBeu96wkgZs51G\nOgpkXEgTBB/QFJf3/qgLgLPuaNtoRklu2qqDS3GSIZIypRHy1WRER37L2R1U\naRdDsp1WBH10rg+Njl4bT5jhSRr0hHp1qNyu5vtMyh13QM0evY+7MXcb2ve3\nN8oUGe83SM+mEOxf+HV29e0js522ZNgBY9wAfrhd0nqbnGg3OCLzpzcknxXX\njJFS\r\n=Lv1s\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAogHMizauV2xNQU9hfyhqIBJZZqj2OcepbI8KDaDzgFAiAsS1fzgsRcB59E3ZKDNu6pMfPooBnaUr+L21yn99C7dQ=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.0_1637746782033_0.679055685222216"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.1":{"name":"ipfs-message-port-client","version":"0.10.3-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.1+62d8ecbc","ipfs-message-port-protocol":"^0.10.5-rc.1+62d8ecbc","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.1+62d8ecbc","ipfs-core":"^0.12.3-rc.1+62d8ecbc","ipfs-message-port-server":"^0.10.5-rc.1+62d8ecbc","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"62d8ecbc723e693a2544e69172d99c576d187c23","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.1","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-FNZ+Fd8kUoMSFoZtM1EiiHgSBjW1FNvueSdgL41e8ww4tRPGwqSKnZ/WSrzq+Eecinav3RTYBxLQK56UsapJ3A==","shasum":"4587a2a1f84097a05a582cd3bbbe4deb9f795bea","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.1.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqfbTCRA9TVsSAnZWagAADD4P/RVIY8FFBvPSipdE+RYD\ndJ8K04sYmsgsm2wy6HFLgzK5MnmXdAvYdVX7PJdERQx4VL0o2RN+U/rWiZAW\nMuFIcYGVWGR9YVoVQNJnZtGK+orVFNC1mLX5uwbpONLNATCGOBw90ibZWt7L\nXJjKEEA6tM4MEosdw+vrZgbR67Im1yyyVzhrrOEDOoyiJxI9SM2A+xH0T8j8\nmIYhzs8KiQPhuOSNapH6iLy4cJO2Whhi8dAr+2/jiTFM9soUiHQ9Y2ujBUPl\nNROp5rbACYRxtjFPHT6r5+0rDA/PEtj9X3kPeefC1J0+SiMV1BbNGVqhzb62\nDaOpypPD8vRPBtsQpIt2Bh8LsZLTeGatYK6vpslATutsR9geZ2zyZJNJ9I7O\n8p5isV5IWQZILN2H7IaXHjUBz5fjH/guTkCi2KlP5uincnwYZGRdJThhSUgP\nhLWaE92su7OGYURW6XT6THZFDShT3j4bWw9DhXaPl9ctQwtFIlaHa6yMMNU3\nRdFmxwShXrjupHMKOR2N0VXT/a4knjKyBlk27PU8uLTFfKU4hrAeH5hswUhw\nkP1XihS1Qtm/KD9MLuhJ60Y38DPFsll2/IV0NK29SHc5F+oCrWTx4q+owLaR\nsgQONCvxWVSlXqywWPz71Ya+4PGPR7ImGY23dLsiJFUtVFbbCV2xWDWyMN7B\ncARk\r\n=rrQd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB157ZEFNpEek1V6+c0DN3juK1LxuZaH37jypFgn+gIBAiB6IEq2OM8sErzijyJ0ONBMEMEm8vuLBZR2cvfXRj2PJg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.1_1638528723293_0.9514462354508622"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.2":{"name":"ipfs-message-port-client","version":"0.10.3-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.2+0c269cf6","ipfs-message-port-protocol":"^0.10.5-rc.2+0c269cf6","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.2+0c269cf6","ipfs-core":"^0.12.3-rc.2+0c269cf6","ipfs-message-port-server":"^0.10.5-rc.2+0c269cf6","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"0c269cf67a8f6b48809472e83c4c1cff156afe0b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.2","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-rakKUZR7EKWhbTzRuaPbfdFWmrb6+61HZJxmDRXCKK6qgMFggi7eJEEVnH5taZn9dxc3miJ1qXWXntREvtt+cg==","shasum":"361500facb705258e1bb7670f4b3d04cc29718cb","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.2.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqhsGCRA9TVsSAnZWagAApwQQAKFvSm1Ig75FfEpU9ASs\ntNULuRO5PQQKdhJ+4vJUgexP6QxWirz7zwprCmh4tEncqiwdnIqaXaAMLafa\nKyZL3FI/SAkIkWoOTgO9lW2ISE6drc14/1nRrIp87SkmASmca7UZiEdSnKQ2\nJJ5CFjToWsveUSPf5d2Fjk/dyMcvG9ypT4kpKnA0qB+JsdyG7zWRF0D/sAfE\nRaKE4v/we5/radD6igmUnwDK1ZIUvFcIAKpi+QW0oV6KZ5Oq9gsYWxB2GTfo\n0FjIlzwWAAsc5RPUK2RIC8DEm5dvJmOxk2asujRmNPYh8EnbetyRzvvMBLT6\n7afEklNjDUTpXP56IUm863A/u+JY+t7W182u0emIBAeAjV3DFfCwarMIcoD7\n+e4T7gYDdNpGNZeyF7N/rLdzW6LOj8vs/CSEwunS7Va5UVjkfI1YhLuoW++f\n8+ZXU8rOfIsvqOHntPB/b9ucWLk1u+qH+cywjASsWdDA9DYv+2VFfAz04hvk\nZrFsM2WOY6jxyYyOmgKanIXR8AE2MvND6tR8DMvvWcQFoqlz6AiLPE3XdEu5\nrZ/xCc/iFkFvox0GQdqFVnEDNNl/uALXuIBBTBQ5/aODrKoD+KohVa5ad2W5\ni7LoDAEsZpASq+MxHVH6cvCglkdnCQFiS0NSEwQdUjljBcefdNZi65w3gnn+\nm9NW\r\n=BkBv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGMfoDjo98SCziQFf7XkESwFyhxoaob0aydINLdOBM9wIgS81iSge+pCuNxuz0mPPGV/0MJUEjSXDtgXiUwHlnpHg="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.2_1638537990420_0.7637494874532407"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.3":{"name":"ipfs-message-port-client","version":"0.10.3-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.3+38c01be0","ipfs-message-port-protocol":"^0.10.5-rc.3+38c01be0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.3+38c01be0","ipfs-core":"^0.12.3-rc.3+38c01be0","ipfs-message-port-server":"^0.10.5-rc.3+38c01be0","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"38c01be03b4fd5f401cd9b698cfdb4237d835b01","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.3","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-rh46npfcOZhNv+4EwWjxL4gMuJrLU39bQIbpzRkzKB2+bqudXMJ3KvHlXULgTV/+BDFwH7nZRRSxo2P2tDjT/A==","shasum":"ebec20eb97efda2d2a77240d0a0b0edfe401f858","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.3.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqiQxCRA9TVsSAnZWagAADiQQAKQ73QCvbHGCqwAh5x0k\nCl3Ugm92w+mFxJA5aRpM9riGQKIgZf6b7ULWw3nEw2lSZQ5ExqOu0RabEFBY\nDRyjr8JEQycm0d9QapCcZjdeBFrV+xHKZlZJRvzbtFRPNhMHH9kphMJq8uPH\nKIPmHOUb1ejsbIBzyEch5ZG/2jXwMbSQlSkNjmHcLIgTBu8vrCW8t/yUZpL/\n9+7bP/6JwzyW5V0nwWtrODhi899FkBlJpS6FgEA3KT8Kjn6gOkzBd0LGS77R\nC7D3tTA/1j2o/54UFmVJjbpZLNyviX8dfOF7Bi9Shf+xlPnnV9WmuERCqq5t\nSH5a15spCJbSk8NhPJh521QIifFqzXj1ztP8wVDM67ffEKGa2CTZukCBsy7q\ndGznf61t3YnYtSqvhBWKu7eMCvVPFJEVDL2cao5XdlKtyOAbXKIKBk8M8UlH\naK34xlzeB6KA6R8bBMbbI2OJGVFXLu19Z49SIsewYBOM7HBKVPBWjycm0e/B\nuuB9nSYYI2/bdAoY1YBbh28zpHseftMMmApE+pCEXgEMHMWVqzG0IP36RX4Y\nkEXm3zXwLOLr7fS7V3ksYso3Bg7Wxr11s/aRFIMwf5AyBy3zxTONKteLmJbv\nPU7L6dcYzABfB5lP/8l5NhTrZonn1ry4ZCDq03l084rdS1FyAnX3kpC6ODgG\nCP8z\r\n=eZAP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG6k7b6gv8GeUkbuExDaSGetQJ0eIq19VnofFE6Ud8YTAiEA/9OMPPBVa6lbn1zk2CnqZ/I8NIr9fmdlR4a6p0Y9+Yk="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.3_1638540336939_0.028690830595017314"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.4":{"name":"ipfs-message-port-client","version":"0.10.3-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.4+9018432d","ipfs-message-port-protocol":"^0.10.5-rc.4+9018432d","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.4+9018432d","ipfs-core":"^0.12.3-rc.4+9018432d","ipfs-message-port-server":"^0.10.5-rc.4+9018432d","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"9018432d5dbea466b8332b0a917a166942e40d29","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.4","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-/F0c/jAYbWzvpjUUqke+CJSXKT/z1KzEuVqxeVjO8/7/gelMKTy7AOYIUH1x5XSaIL0c4mIrAzCmzyBJV96chQ==","shasum":"b9816f1af0e35c70c6e64c1c2e4f4e38df4b9923","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.4.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhqjFXCRA9TVsSAnZWagAAgI0P/1iTdeg2ac6lBZGO81de\n4jr1JOH77EyejXzbBSWzLi5ghPVCYaCdzBKk6EJIvgUtUlH0q/vYVbDrfEpD\n03HArJEX1LPx7gKW/R0nijPNH9FUQNIszy53xClSilSqPuHVcCZGpNXb3s8H\nuWPgXtjyzGx+VLm5icvoYOora6ZOJLvFWpeoX5XflR0qxRCK58AFNAfVPeKd\nd9CKiSKFj3N+b1yJv2IC50njqwVnJzc8+4+8V7qra/pOrDandw9ugG4k4NHV\npvSpIUcuG9PohK/jePFbpLQA4kAA8YAagjw/ZQN+HCwQOB4X6TjXMGH4hzyG\nwLHBqg0BwT7gGc7Z/tFTKFQw+HugYi3LAmsvD2cRxCBs+EJE+CeXIHi6iTuQ\n+OYzhcjvGE0l6M2IEOiPeWQH3i6ExX8ffYGHP2E3NpQGodb5yrhU78Pee0qc\nVjyo6QODtZ41aq1XLgP3JNW9FxFihj+WUTL2/I86OGPMoOUTpF9gZz+2tCQu\n62qyVlfcfpbowL6bXpZYUrWJ+LSYgJa7U/FfXX09chGWazzzTLBa1PWf66Gf\nuXFgDtUZQu4adgha/2LmGdnXL8H5RXemQYBmXtQus14oUSmes9nc/FNrXMim\neGgaa4CFOclccr0DPDNvr+QhfkJV2VC4aAfTzxPKmu7RAHf1qsk0MkNq9liu\nUtHt\r\n=fFFX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDHkgPLrRzWURs1Mp8g9+qYXz3dVG9oDKlkH8R3MwPPfQIgV4W0kZk/rmKhTdAsMbGkg6aSaWEtJ4OJ5QzFg7MDIkg="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.4_1638543703464_0.35123599504267866"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.5":{"name":"ipfs-message-port-client","version":"0.10.3-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.5+45ac9730","ipfs-message-port-protocol":"^0.10.5-rc.5+45ac9730","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.5+45ac9730","ipfs-core":"^0.12.3-rc.5+45ac9730","ipfs-message-port-server":"^0.10.5-rc.5+45ac9730","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"45ac9730d6484e8324acfbc3579fce052b8452d7","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.5","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-N0SXhA9Y7dQv1ZQedWhrnQAk//Hwjkg9Yo+CcEu6V8eofDWeAbMGB2arlQq6lNuFCr6cisVVc/I8y/jx21M/sw==","shasum":"2d8a2520bad807a6d8e84f53a753a0ab30175443","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.5.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhregCCRA9TVsSAnZWagAACjkP/1W8Met80fAiP7uvGjla\nZhoJAATjkKAKeKP08Ji/vladjKK+oQRXuKQ/7S0p43xtkGApixDgtMQaC3h1\ntqtBlcJ3LuEErXDdaO7aOM2yC5xXmLF/5hD1l9w97U60SGi2CgUWDi13TPQe\n2prU4yTq3gB63H58GEVNfpYtsAuZdxb8DeYHFWZzbehbLLPa4ngPFgmyC2u2\nybf/bl6/i6kY7xc+5lIkjwx7BdDkyBhc0o9vlTg1UXuTKwy3KF8VHBJSQVFU\nAOypw9aXK3Dw3CWruwUbC4ZgK0wlQv9uqFGqNyIgcGZ98X5b1gT8sCcR5LA/\nOOPXbAzzbefu2d8tkWu+fe/bSgsATJMT6YbLB2yazcl/1oseOUCHNrLSKPdQ\nwBIQLT5e+ZaMN6Bt7+bSIi4mjFmt19NHuijUe1/ADBpNM35lA0iju8aGHPXQ\nCBn2xKqrlT0m4SIigaEVPJsc6R6vkkISXH350RdynqPvJLQVowIHYM9wuzfR\nfiLClQ7o4eidgwmp0feYgYgiIkv2gvgV+j3m8nq69oJ63+xGlFiB7bOK9dLU\nHYbwpZWCtikQ1j9V6inbVy8tiV+dvgysT8r5MjbcabjtTpa2UKNKGaJ4nNCm\nyG8GM2P3bMzdE/v0t209xs7BRKDRk85aXD652RjH2cMOmVQgU5kyCIT1zBcV\nTOuS\r\n=jqyq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7nq1StWa+3zH0z5tfYRxh8MsgpUbcGvm44AjHzqJkSAIgRE5JunAVAtvvC6mEW4aX0tUXyXutsbznknBGW/lWdgQ="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.5_1638787073923_0.8046461866055152"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.6":{"name":"ipfs-message-port-client","version":"0.10.3-rc.6","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.6+80ac58ca","ipfs-message-port-protocol":"^0.10.5-rc.6+80ac58ca","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.6+80ac58ca","ipfs-core":"^0.12.3-rc.6+80ac58ca","ipfs-message-port-server":"^0.10.5-rc.6+80ac58ca","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"80ac58ca27cc9f21823a23d1e6357f738fdb6781","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.6","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-dhkV82uSCag1ysRF5z9nT3RXRGkBwyfZmrDOLdOCwM69y4y98Lp8ECCh+sT3WlpONDtEmIy3ZZcOdwVqc0zRiA==","shasum":"2e50573082fc799d0ea9838c8023c517ba017d8f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.6.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhrjpOCRA9TVsSAnZWagAAuGIP/A1p8vmzvjDNGqopioxc\nWjgQ5R31AfLAM52LBtRElBWEEztDoeE7r8TAzAI8MnIvacC+qp6LPSlgQRLz\nhFExx/ZQA9f4qpd7OROwsvXMQX6aYdUaGJBmDU/uhFCnL2fHfq/rPtR6GVWI\ns6c4TTLhxqezjZVj6j4VXiNJgtl5WULbfOa7T9QRCV3aWFna18QKQ7IZtxGG\nAlxnv54Tg273iraDTe9RLr+w9oJ1zXBsFVWLiGEC3fkt5ulQ72XcQ9HoWBUQ\nNTGY28PWxxriveed9Hop0tYc3Vhhd3ErQrMaSQMi270Zs/LGL0U7480svaLc\nU8R7zUMYtY19bg4eHNifcCdT2WCVcAu/4y0aWUoyudJsf1o7H/6qMVDz+QaU\nrosQx3VSdJ8cHdPI897SNkQm6vMX2zfxuqfbR9SAMSGEd31i+/Qklm5oXBd1\nF/pniu8+5NzHEIvI9ezqbnWCLLL0XvWkEVCWm06W7XaEaAYmU6ilykzh4pSm\nhgxzvCH8NqwEiuBPGfv0oe5BfevycFw9HyKS74IOF77HGnXrYGabeHPuQiDt\nF+0pfCVsdWjbYOEaK8mRIntIciSzPZlP1LfBtiDTc6jytNIOPAIOmo/npcvI\nbklXRQiEaMJj6hzR8VOhxFk6tC5tV1vd1k/WreJnpKbXky7woqPH+xy0B2ZV\n6h+H\r\n=LX39\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE0zDCYbAY83vUFQYbv8qfyMO7h+WqWQo1adAyiBeyfvAiB70TZmPetG0TP1U8kNmlfc8ib96zPrWA5b+wuupXzEjA=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.6_1638808141961_0.3914468698181399"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.7":{"name":"ipfs-message-port-client","version":"0.10.3-rc.7","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.7+c083645e","ipfs-message-port-protocol":"^0.10.5-rc.7+c083645e","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.7+c083645e","ipfs-core":"^0.12.3-rc.7+c083645e","ipfs-message-port-server":"^0.10.5-rc.7+c083645e","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"c083645ee68aee2fd40f0bd63fc5b4d1395b5b33","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.7","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (linux)","dist":{"integrity":"sha512-0mteQ1vQ9Fl8CY6V6uWId1eSfaWLVXHdP6G33DeXoRn4iZAesHcGwNsFcpDNtd7ZePoYngErVPUPYj6xYqsvFA==","shasum":"bd3f868a999163e1540fdf259842d28c746e41ad","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.7.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhro1xCRA9TVsSAnZWagAAkM0QAIQWKK/XTvm9DuJRhJ34\nUGD6Ln/xjX+ytw8Tn2KofArKtn5mORCDAlY6niK+6/XShIRxRz+NxrnnYmXC\ns/TuikHPJxbu5RkQdEeU48dkN4Oa4NxPpSOx8b7teTCx02uVMsSnrb9E/kX+\nsfODFB3AfjnN8RIHed/0kOuZAAQX0ibYaVDma17KtDxFIyrQIOXejjLH3iq6\nnfPibDmMjiJg1BDrMXn1/H3/5vLGdEc0Ej03xtgGNq8haR0NHJMdIswxE9e4\nb1Tkghur/4FyKhYIA1MKbHS/IgkJm59H9gANnLkD9Qe/qdcfw/5GJguEPgDu\n646p4tpY6s57Hd6neyDAZg5uzMCRGigtNgH/dolIlxRPlKOnayaOhYr5fCOu\nMmH50PYSHAYEbK1hYLYTKhP5FmgyzG8VluFjV+34xflOn8tjm4HyQzIGdEQ3\nXQux7nTG1QqLiDkC7HBK60tbwFQtn2wgNTotdSH6UPLuAxtOOBzL93TC0OQy\nEpvLrrrBinqOhxo94RrOtWFi3UlpaL6UxLGLYRpCtp9gXjfWnWfMClZ0/y+w\noe0MSBS4Jvx9gbIYA0UhHmsV4P9Irbmf/KfmNxXHsquheAmcQMIAI9FPHnw0\n5PfsJxyb7O6dm5SRFytU2+47YC2aIiWVAjwLOHfCR+QgtO89FfpViaYpSOze\nhGlf\r\n=7byl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDCsd9Chu+fS64F+e075GAngFRCK6LZ+c1QrzbeE61zBAiBPH/f8vIahHsatx3ndGetB2KA2xPAtGWI9kOfpn2NL0g=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.7_1638829425096_0.0002477600538246527"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.8":{"name":"ipfs-message-port-client","version":"0.10.3-rc.8","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.8+dec9e4c8","ipfs-message-port-protocol":"^0.10.5-rc.8+dec9e4c8","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.8+dec9e4c8","ipfs-core":"^0.12.3-rc.8+dec9e4c8","ipfs-message-port-server":"^0.10.5-rc.8+dec9e4c8","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"dec9e4c87ca7829761ae6f63a4809783e53ae558","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.8","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-31GiTyEFSnZCNcCzHRQES+m1+Fri0jH+MOzDXsUIGdng7M/m6pYrowy67cmRVshDwvHqGNeU/eBX0UgJbkMGgQ==","shasum":"ccaa6d7a270e20d5672ad0f152b2a951a30fe933","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.8.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhty/QCRA9TVsSAnZWagAAjgAP/j/FN51K2IYobrvOiqz8\njSQnf6FsdUWsrGdl90f21izF1zRQCY2rvQ7CTDq0qURbwxyTBLS/+ct/RQfz\neaLnpKBA/Z0MfokdACoN6/xlTZ9RFkixDdO5rZKU8SpqD+X+r7KVsulS6EXd\nog+d92Clt9/tIktrmUO798zZBvRxZ37+Ue9AVhxYwrgtd0EQWG4dtEb2mb1g\nicM9JW0BRuLzLN5rhku3x9dzEqxtbHOMlddHzDS5iQbt+xL3sXS9VMLRF8QY\nBAk5lNxKAbjAYOmIZAaNILr9zZcW0QAOK5nkBMmiZNW40qeWTGeb9KYeWFV6\nwqS4v0EnVW2zo5SpKgPdUicQS1dENAu525p44QoY7m+d2sKpaOh+iaRYMWUl\noQF+X1lHMqje9806DiC23DV2m4HE+8zAAVUXcEQW27rNtlXvkVn03F6T9VMI\nQPNA2wvc0KYy4bDvgdbgfITZ7x+jGdBmyNyg1xppwQSeHhVVyRwbDZlCST3t\nWEEm/2HTok/gZja21iZg2Uf2rBru08qhLHgR82QCHuSU+h4J00Ccg2IfUXk9\nsMy9fGju7PvNrrDsEy2XW4qmdQu2WqCzeSFZIwCQCBoCnIS2g13hwcoiJWPQ\n+Q6nveg3wIW2o428I5l+u7Nn4C3S/uZQzrHditpaeMD6uGfIA3wBpzA2RLR6\nFg9D\r\n=g0u7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZb3WXjH3jdrwx4+oHWOGM1m5FMsaDhQzwbMY+WYPVgAIhAObl1vWHC9qHl4R+nheb2gtuilPqytITPzg0jk3qZT7P"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.8_1639395280379_0.15408767640730403"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.9":{"name":"ipfs-message-port-client","version":"0.10.3-rc.9","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.9+adde8c13","ipfs-message-port-protocol":"^0.10.5-rc.9+adde8c13","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.9+adde8c13","ipfs-core":"^0.12.3-rc.9+adde8c13","ipfs-message-port-server":"^0.10.5-rc.9+adde8c13","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"adde8c13ba433b81e76033c418607be389fb3d31","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.9","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-2ehBWwXWC3yt9qa0AoLW7RSEfdXsGLV4bChOmWlpPIH40cfOm2Bcm08A6I8fJM+7YJBp1z+6yUaGXah9g/zczw==","shasum":"4b59c58c806eea47e03b4ded7d2ac0f0495cc7df","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.9.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhtzgICRA9TVsSAnZWagAAaKkQAJXvxPhUSV7MD9USFQ9s\noh4eWgtDHWsRuaxW+nKUfJg9jyWcMiVivgky92ON8VLamkwurd+vfNanB0Kv\ni8FW57a/KrN5/uC9yiPGKzpetd7nLOmeAvHG65U5spRY4o9OUzOG4bCWVmif\nTb8ArYC/P0kKWQdfpMaafGfinoEbC2QN0UErlmgx/pCKmGBsQLx3oelc2Lpk\ntLi8vZ3eol0nX+k8bY2/FKGY1F+petSoIf13kNgGzWnRTXxONPClbRPsaHMp\nuMzzGigBVaViRiFvjUj8oVGBV34++ahCqZ0o6GfjNKKbomTrGLH8H+WzOKLN\nUwyxmvgRPKdPXNAXWVQDZI/wntUJ1a9gtklork+wcRcNRVjF8SpFfwFWoYjk\nsWqhBcn0tWv6+5RgnW2SPp/osmB4NA74gdTaSl8ofNktAud/n91Kxe5KTO4e\nikd2olb9yyK49mzmG6fVGDHuVpdDE8aQdo1f2d3nOE5wtu3XkHkO66tKEFCn\n4ZT83HI+p8D/AVsANpfI6CYVNrGbxw9r7y/XqpZdmtAaUvadFPkBgM7JV1FJ\n5MtXxEeSx/f08CHFzLk2zNSonSG40JoSHfd858IxXlwPVfw01F8ejKFPI03H\nxHcKW+EAaq9pcIDjfrjRUQcIFFuAc7PN00m90Y4cQhZUR2gJZOcCfUiJ+HKl\nPnh7\r\n=ZfgW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDVFKwL2QokDYXrAJ/9xntjTuST60H6h36b6nSdv21HGwIgO143+cTd7phPNQmqFX0iAcwOifvqC6qFjJKdCarvwP0="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.9_1639397384509_0.19716149708881248"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.11":{"name":"ipfs-message-port-client","version":"0.10.3-rc.11","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.11+33f1034a","ipfs-message-port-protocol":"^0.10.5-rc.11+33f1034a","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.11+33f1034a","ipfs-core":"^0.12.3-rc.11+33f1034a","ipfs-message-port-server":"^0.10.5-rc.11+33f1034a","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"33f1034a6fc257f1a87de7bb38d876925f61cb5f","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.11","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-hdVICo4WR8lZTQ14q/pHZhcU4jyWwGrQrRzrBX3bnUSVxhYli9PwpxVTx8aEopfghGuHPXiYo3VnXQ/GeIS61A==","shasum":"b8dd735c1850d4900a469647c0a86ab0f1a70275","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.11.tgz","fileCount":49,"unpackedSize":151983,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhueSaCRA9TVsSAnZWagAABFwP/3JhJZS3/s1EnPAR7JEQ\nflTiUoKInA5fxVpF33U7IbLMmyLBtzJF210GyCLiujoJnApXwCShZin8/ZWe\nZ2XHTGisTpSOjAAYRGtUxnO6UaDrEkwjDUYy0o/ssR4bae+y8lnUX9AWL1jd\n69ztoAGIBsaYow3jcwbdPmAdi1HaC6x1VXPex+uRzOPyt4eIbH3WQg3oApJk\nnsd0RLKTjk5EOc9RY7csb7/8xmXyIPujPnepAJruGD+2u9/Hf3Vu6JgM60gy\nHR0ot05Hz7uWd8/fJMIgXb6NuL9Rob3kZHr3pHdnGX2rR+EneYvJn4JHVOMT\nbpN0/CpgOhBGhreDaoLG4cgugKEhOxeFNe1owRXObAYTfCUtE5zA+FYfUZYk\nn6SPfhphBwolitFX9VaIhIOGDp50Nkvwrnn6d6IY6a/PiYDFqjLzpsV31tdl\nK3WQPr8pVIE/6trakNAU61p0i8OPuUSW+PrwFqGIQhFnWi8MOYeUj2ihM7fc\nkdyDsT7CZntHyryxAcfEqYb5Xx5nLIt5BKSbM1OpEN9NKMjjELZkco3EC4ZR\noZ050Sd0bP6iOIiZfa8EcKwuo/1ih6ijMGQrtvmKt8G+a6+h+ZL3ZrQT+NaC\n8xaQwXtY+2Nh1p7T8g9+bZSZ2RyqGGL9mEPtQ1WXKKSf76nMrAHphzBbXpkp\nPaPp\r\n=wwYn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBRlLVW6z6hXiJznzN+iOGNArJsPLqVtWWN4lUPcD5a0AiBhu/davXEJs+jyj/7PKwZue6yeADmyg5MM0QpNS0Sv5g=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.11_1639572634138_0.8818923099372746"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.10":{"name":"ipfs-message-port-client","version":"0.10.3-rc.10","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.10+73476f55","ipfs-message-port-protocol":"^0.10.5-rc.10+73476f55","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.10+73476f55","ipfs-core":"^0.12.3-rc.10+73476f55","ipfs-message-port-server":"^0.10.5-rc.10+73476f55","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"73476f55e39ecfb01eb2b4880637aad658f51bc2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.10","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-NG8GrSzP0nGIPJ8T2nWnI3l895RLSj4Sz+zJhdKaEjd8n9vyBx/+5m4v4+uTCHL9snyLFHOebLD1zOHq75o+Yw==","shasum":"ef37830aa1cb611c45b3654b4e4aa5b37060379f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.10.tgz","fileCount":49,"unpackedSize":151983,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhueSlCRA9TVsSAnZWagAAXPoP/i8MZNQcnO+ctxdrPlyD\nb+E7Eog8WEmLIWfWHtpRz4rSGfCxsJjPhrSINVC/Vrer4BeSHYAob10NpoVv\n/udbWdOvy91OjB0zSHyTPuwtwBg+EXpraeHGSWc7cMEN5WPjqq8hSc3NwcO/\nN0QwdD4zIJZtYUsYPiglQcisK18zPTPykqQTUM7p+qQq0UhEZJA5Co7OQVca\nQZHSQ+wbxoeGA7Bc0decEAzHSd+aZxE4dLOqp2ADfPv1hyuagMroydZn/7e3\nZWofzaeCxki33AStHtijhiS7YxIp8E3jvzVek3vTHpUJ5PRbhPfaf1Zmpt9w\nOyRuCV3T+7L2/2HaQBV/oDX1FttADhvDsVPiRMCTn/qxf2rpm5+nOlWZMtI3\nImr7NP8BVfPKgX9w4sbbRt3WNeynQ2yML2SuDO/8kTnq2HbIzSq4ABW7abak\nI+W0Vs67v1Lu0VeWkBHLDQMxIWsr2mrtqTSmcZE4YhWCp5ehoex3ZHDsG5hE\nUN0KqQkDt0FKObD1Uzoc9R1yuXsttL7t7P669+m+m3rLJERY4EtiVIY1UkvV\nFXzGxFkgO81vHm1h9LApYuRPYahbsldmMDDWs6VUhiYLsxVaPhGFVCOkjt93\nMrzLYR/LGj5JgEitho7coJNhbtgq/rZk8U5+kKm/X8QGRy0GzRor5GP64bgB\npu4a\r\n=Vk4y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDkaJFooGM6tmYA9G/U7Aca/prMnC1pFNdPjwPIklpnFwIhAPGUnoxoS96HrGi/yhUPAmEYMtmLThNTDdcNI4tE/gkI"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.10_1639572645537_0.280675267436284"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.12":{"name":"ipfs-message-port-client","version":"0.10.3-rc.12","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.12+6eeaca45","ipfs-message-port-protocol":"^0.10.5-rc.12+6eeaca45","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.12+6eeaca45","ipfs-core":"^0.12.3-rc.12+6eeaca45","ipfs-message-port-server":"^0.10.5-rc.12+6eeaca45","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"6eeaca452c36fa13be42d704575c577e4ca938f1","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.12","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-N1bkgNvDKjDIF8rqxa1Vmw/9M7Jw0yoPpf5Q7skxV9yHjlgCBUn9sptTRqOkNsXK4QuvG2wzHFSSuKpuwFnAdQ==","shasum":"156a92d808d751da2c7fb8c09fae200b9ceea54d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.12.tgz","fileCount":49,"unpackedSize":151983,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhueU0CRA9TVsSAnZWagAAecMP/3Qd9GuoXUp7HZUf80an\nRIds6Gzeml9EtOYMm+UhFUJhLBaKYeXy+W98G2ypu8plfOYpvhtO8b2/cjcE\nidg/KU+gd19l8CaQ2UCjMIW+tGT+dayuFT09H69Zf0rY0/De5F3G9cRCKTkV\nJFMSZUD8HsyrJY49/toYRabrdkiFYldNspDEh7dcb6AbjWOoJppfktSK3wDN\nkmNWRB+W/ibHdIUclMyl4wQkIIQIrgJ9+PRUptclsMDuyf5IO40WZWugmCKr\nIoOwYzUDV4LSV9gVKe6NpZGDn3Sxtv+JkFVjlVOzqa2tevsQDCuIXlYs3B2y\nQHA2inA7NL+yALguB3RbRkvJbJtqTjMPE7Q6jEiPlJatZJ7+Ax8ovD/XhOzb\nsPNcWaELPnZnDd3kGGyMhp3xcdh/ig+jEssZKue40BYWVblnd+a/93mw4k/R\nnO8+wPZLzeMZ2MUwwMeW9bnpvXUJQwW5ZTCeSn5AKRnjZRbyltvaOH/x6L1A\nge4lcvKukqYhB9jDY2WLFZyZonO0W+WGCbOIJTSN2xEwkUs2qsd4REjxQWFm\nu0fMp6vJsqlqewrRIW+CXxFAYeCP/UimrZ5djSjbnfLDBjAiMrQuxPkBqtES\nS7WBVO0c/QCObLkAaNjIiD9cRd3mLjEeS108noS0NXSKkoYL8Dn7ss2qsB21\nSJsR\r\n=Vq8K\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgYpmnYqZvAHpFwPgJEKGtP9tmYkxRrJjuepy1R7EFVAIhAIxjiiCWb/AhkRxSDxK5eKp0MonVyt9knSd2ILbsqd0t"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.12_1639572788005_0.35097942836610896"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3-rc.13":{"name":"ipfs-message-port-client","version":"0.10.3-rc.13","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.8.5-rc.13+d147494f","ipfs-message-port-protocol":"^0.10.5-rc.13+d147494f","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.152.3-rc.13+d147494f","ipfs-core":"^0.12.3-rc.13+d147494f","ipfs-message-port-server":"^0.10.5-rc.13+d147494f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"d147494f362d38244bbeafbd6e7d76789c7c5020","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.3-rc.13","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-/G3519uIY5MJ+hAEFsbTwEastAwcLLwICMU4X7QY66vMnmuC8o2ewNBPp6FnYLNcMue+wc1i399eSmL3bPuiIA==","shasum":"977bfa0bd2e707e9993ed5d9402f886326523f78","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3-rc.13.tgz","fileCount":49,"unpackedSize":151983,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhujMMCRA9TVsSAnZWagAA6EIP/2c41Xa3EA3rie9KDzrZ\nTkFzHu+ngcZoEpEqnCFzEEiGN7hQMwcIcjF1H4NcvABrUOWw79IcSAkWlQPY\nVKmkBZnafFcvpqU0Sw6k1Y/Uk8BE6KUYysMBU+Vi2utcXrjSUJIRmd80mRoW\ncERpSPfdJhX47O2ntxZR9xZL8gB/0gtwlLVTfMydreaHYN1qH1koa+vIWtGG\nrzD/oNITp6Tremr+HaaJ3U3Cnir6qEZC4pl9yOyDJ19N+5riJhvRaX8GDkUc\nCS0tCIY5vUjFyhn6T5Ef2y3JSibjmZSWIYKqRicxyArMh/NLXTK/PCDmAGzX\n4VHj+ZW2l29AEZ6GUbYkp5x+rrYhh7FqEYtz2f0CgsBPZY1hu2Ktp7ysQ1V/\np65qRPOXVWVZ9EeQTmF2fJMevGQowDCuCP5Afw3mU1OiJgRoUABzY9ixJHL6\nt8xr0lS+FHNz99xeA+fSgrhz+u7G22DFh5HRor13icd8KnEeQ/vKZidTpl1O\nIsPrFgqhyPkhOYB7TrcKzDI1ghYHBkzoTRSr/wnJgBxYJ2k3VsT3oYM3wYlW\neTpSyEjcikImtHv7Vv+t9nAtjKw+LCn7735MZJgw+ZauWMRTf5xAifo9mHJ0\nNQjYdyDM+h/LeM6IDNhQzgFoTCERnOJ+xy7sv998MOmQyvM/Bm0i6YX8bEK0\nBM8M\r\n=C5kY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJ9Zwozlc3PfPxZLyyakIuPWD7WKg2Bz+fw8tC55l+3gIgHVH2rnq/u0cQStZhrLtHst7bC4YYhZO/YE0scdcV6Nk="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3-rc.13_1639592716185_0.4846524109732766"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.3":{"name":"ipfs-message-port-client","version":"0.10.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.0","ipfs-message-port-protocol":"^0.10.5","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.0","ipfs-core":"^0.13.0","ipfs-message-port-server":"^0.10.5","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7375caa8805298fc671ed4080e1023aafe756151","_id":"ipfs-message-port-client@0.10.3","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (darwin)","dist":{"integrity":"sha512-lAdIdU8fpZBGUg1dG22X55Qnm3N6BxEVf4d3tYu8ITaIxhrZ2nm2HmkNzlc5fYeIZKTICThIDYiqzqMTrx67aw==","shasum":"e7e5815c7278c1c72bbc04d2266d2e16e62a2095","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.3.tgz","fileCount":49,"unpackedSize":151893,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhuk+6CRA9TVsSAnZWagAAKDUP/1QQYas4eLtnDpsgF+kk\nPnoMCL++y5VZFKaZaBSukiCEIhi2L/zZ1AvHPzWBGLA8kdI7OB9iQ5Maibvw\nFFPMJZexNSyFhbDqofZ1HcsURdbmgSomvBWGiQSUd2/0JP4hasfYB+npqwFw\n2jSxGbphKry3gpue0GkXT1HvVRh0xtf2b+Wa711anp/hnKGuWjAOW+d8mUtC\n4O36pnFc8V3DKRxnGcLwI1nADY6UCOniuKfPnGG70496VEmBuKke2MtKtzw9\njt6dVaHAOqcDbq7TMPsnYr7Hyw0pKuBAeaEktUEJTuiDHPnFcnWXQsglLNRf\nMhId3NQ6pZrFfkeVnuTzW7bzyo8e5Ch+hMe4Hi+SpX0WUsT0b8X+CDCQQIts\nxihhgh94wiU02deozGPaqm87/9EPqRFXaXyszCJBwHA8GJ/t8WsjK9WJJOBb\nUb0QhlZHjzBBn0lTxfCFurpNIM4/5mHAn0C4NY6w/VRVyXAdVG1ou/zCnMGj\nJqgFV3T7ZCdAEDnlI995uT1wbkWup/KfGXr6bMtUp5prM0DVDvfgmB8TIQC7\nE9io40y54sKWiNxTYbyqaAT0mPRNE4cKQRd8EcoaDmqJ2bIpSs6gNWY35ZCe\nXZxOs2D/mBD/Eo8GuRSHOqxpHsn+tJo5c542TSYWXqF67ItGTnOLT7aIZKwJ\n8Tdu\r\n=K/vt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA9YT2Y1MQy4lcyZL6zZDVnyWEhP1PJsvuG/tnfPCG2/AiBvXjgKj6UnC/9wQBXbFxT3yXmYjWWLp4hc5LHp/8Y4Ag=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.3_1639600058777_0.9681103100957995"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-rc.0":{"name":"ipfs-message-port-client","version":"0.10.4-rc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-rc.0+7375caa8","ipfs-message-port-protocol":"^0.10.6-rc.0+7375caa8","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-rc.0+7375caa8","ipfs-core":"^0.13.1-rc.0+7375caa8","ipfs-message-port-server":"^0.10.6-rc.0+7375caa8","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"7375caa8805298fc671ed4080e1023aafe756151","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-rc.0","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-C5q1VGTsydGCvpwIaoB5X71+xsJ8V58uOmHWej06GaDDYsInVUTvmMSe4m+xk9qwLAdIiZ0H1wB8tnVjf/Q17Q==","shasum":"7b65380a7d107533ac56ee29a8456c612a7c3af8","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-rc.0.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhulBDCRA9TVsSAnZWagAA5SsP/0xcJEiwZuVl+/VrBF1G\nLwjSR1VsjhzOVhqkK4CiefPYJ4EsYYfao+Wu0fjf3leZXxV2IzEJSUeDOnB4\n+RCTyf+6/ImrmMxE+xestE6/bTdmaEnDQ469btQkMKyCycFh9Bs9FGYertZu\nPOtnMHIcjAEJZ8xnWembxnsr70Ep8SU7HuN8Ijx4lG4MM291TaF9wKbHbulp\n0QWn1itDhtfRAJp8I+8fMj9qZffnCSzcm/lf2RkOLOsBUgC/pqzJTMQr6GNp\n7jBXu722rh4Mr79C/BwzOPC8e1SE6IhfIU+LsAljV1i30S8GPnezafb5Xx2N\nfTqVTM2/u3r5xMFf9bKEkuWg9LmMIYIyULMh8rQy3zQxQoNXM2lLGMp8DOs2\n4DldloxuwIo9SDZwTcwlxlwYtn0ExbdIt1KGt9GWn+JnECMfyFhK5y8Rxlz9\nCq51HX4mvOmNJDnmcikoNpyxlHPOhLPwTP87Rxeh2VMwFEL2qaEoeTMdyneu\naRPetJg7nk+9e2dyHZLZCDBXjf7o9WtByezKdLRs8ZGAMEAT71gsGQl/UBoM\nyPngi/iwdbh3Ic1GmGdNrquEZDGVqQ8fJBwmr6W1nG3qbYzZdedXB6De7pOz\nCrF+onZw88cA+cS5qjIiMxzo8KqcFdbIc14lz5nrhaeaVQRKdiuO2OAnlzG/\nyX8U\r\n=2Pfj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuOCASLPDdSmEJ6iqdNxLsNLUvF5Cpt8DrJCTx+QtZBwIhAONeRetHblLNFc/eQJWpxcmrAQhSyvG4jI42wKlz8oqH"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-rc.0_1639600194831_0.568469720326032"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-rc.1":{"name":"ipfs-message-port-client","version":"0.10.4-rc.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-rc.1+880e47d9","ipfs-message-port-protocol":"^0.10.6-rc.1+880e47d9","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-rc.1+880e47d9","ipfs-core":"^0.13.1-rc.1+880e47d9","ipfs-message-port-server":"^0.10.6-rc.1+880e47d9","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"880e47d98cd89d774d707d20bc4a3db8c0d3c5cc","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-rc.1","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-Zc7YjTpEXf8x7QFxVYiEp2RgtHUyRCMLDd/ZiXzp2hY1LQkyPyA+XoAnMLP+6XZyDw4ERFiL8l1CrvO5A8dWxQ==","shasum":"5f9f54ef221faaed1b1a123f2aa9808bacfdc30e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-rc.1.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhuwGwCRA9TVsSAnZWagAAQsAP/R8Uguc9qGR+yKUwzI7R\nLsW4y6VYDuCoJ3p4JLLNRffK6y85hyXA5aKPcjJpdIaaCsfqCkV3lPX4Eo0K\nb6MnSMiF2xvRhRmNwiDr25pwSmIJTk1ANKpOJj2JyovAqR3e/rYt4e/caypI\nPbjlck/e8Rcb/lwXLSe6U7mlCm+i31hDeRmeQVEBVbKHa3dI0WpVyz51ayZP\nMuJB1vTCwTKpflAub/kwb248awDDSN4vD3jnczLDdBS0PkBuMoIPpge0iq6A\n73YWdqjF5+0/d2TXgmXEKAElHPwewYQNjJ0T7dBA2NvNoEhvb2dilxOab0KJ\nf5xXvkgh4EhgCkzkhQDiS++KbKYu7zreYu0FVALjzTK0KyULnz+CtYS4EWdI\nX82bY8hF58cDAil2m75cxPFlq6ANDxrytXZQxrDbUXZWZNIyGIeH23sAQkm4\n7oPjDyZiUQcgpgNghB26y0B7jLsM89YpgOYJYHBgWoMRmjd9QxAA0dPkpznv\n0wl/4I6E/OlXdIecCX71JT9CLoYEsskoW5FPi16punxNjqI7IR0uPfBfo4nP\nlyEDLe1NkYsgduSLAFt4j0lLZKdhdQQNPpuhYzaTEES89tXbrxDqQsJ69sqX\nGWivA1RuakpTgnAzgUfe3vFuh2YCBaTfbFlY0Z2nCI7shTzRsPy3V3fILVtf\n42U1\r\n=f8Qb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH/iq8O3YLEPEs9c3IxgSijOHj3yrpGmS+hHtsFharCxAiAw0rQZZuM6ZAA169VwlURDeH27KueDRVeBlG2y5IbFRA=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-rc.1_1639645616775_0.42537905612158733"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-rc.2":{"name":"ipfs-message-port-client","version":"0.10.4-rc.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-rc.2+45d9baa7","ipfs-message-port-protocol":"^0.10.6-rc.2+45d9baa7","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-rc.2+45d9baa7","ipfs-core":"^0.13.1-rc.2+45d9baa7","ipfs-message-port-server":"^0.10.6-rc.2+45d9baa7","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"45d9baa7576a0ac924f3d01d49371bf1a4cf654c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-rc.2","_nodeVersion":"16.13.1","_npmVersion":"lerna/4.0.0/node@v16.13.1+x64 (linux)","dist":{"integrity":"sha512-Yn4c9Utl/1nlXaLxwz2XMpSrvCHtTqbMcWKXORkX1Q5813Y5ThUHyVT7OO/hq4JatBklZ312G3xWfb87cvN9Lw==","shasum":"962fe612dda0e42c3f0bc27348d90a97f5b761a2","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-rc.2.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhvF79CRA9TVsSAnZWagAA6JMP/2RXSY+X6AjLnMKaVVFc\nxuXaa2kvzoAnL6B6vO+pxO/tlyne6JCHP3VDTGz4D8YqoNBWlK8QYSoSrPHu\n1c+ZSKQZITXDENm01LIUDFwO/CTQcfmckCqE68cpw2KXEVzym0JyTc4OzhqS\nBZY1cWp2RKfQKVO/cJusp5Bdhr/Fbs2H8ECEUsYcpw8Dg2VHIJ7FyiV+2W6Y\nnDe6+aoHRcEpC9xc7hrRb4CXI+NNGVA9hc0s74KIyHbn5RyHOZCCch6T6Co3\n9wrq5Kv8HImtvaJrrvTsqEbfGJHm2/dLqYnW45+UEe+e0AJDZ51MAZgCtZpP\nOKfv4JEF6S8ojg2MmDVJSFZJn1HZNkz6DJKGEW8I4/FDfjqwzN3blYbt8g/o\nkf3Nnw3r6gRLYt6DKhefZ37CvRu6UXTQ0ExMfrQQ5p/KFiWt8yqr36+r2F0r\n3Qi/T+xSC5Tb0DB3ABt5ZGs5R6Oe50TAjJNjx8CkM4ALRVX5aaAmEHxOt5Uv\nn/aPriUocRVQCJbOC4F1UGA7KXlwZN+EtTgQQ9/hTAp4I+k7B/IVwGR/7bfe\nJFQr9lIWFHsoINVRbpCxDalbc6+7oN9SeeugrKMhMYVPbBWBr/ZM6HaWbevQ\n+omjmqYZOlGeAdDn5hmh2xZeIm92nJdS6j1Gk6BbUZAFI+fuIJ87NnHgF89a\nNh/S\r\n=a0LD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBRGmyRklMih/sD9t/rR01VlQCBBKwRGOcOwr2wtn8WJAiEA7JsVru+ucv/cWC14zQEOBt/g6cTamXUJdysc2skVVas="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-rc.2_1639735037336_0.6366275490824624"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-rc.3":{"name":"ipfs-message-port-client","version":"0.10.4-rc.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-rc.3+67a8c47f","ipfs-message-port-protocol":"^0.10.6-rc.3+67a8c47f","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-rc.3+67a8c47f","ipfs-core":"^0.13.1-rc.3+67a8c47f","ipfs-message-port-server":"^0.10.6-rc.3+67a8c47f","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"67a8c47f7eb4ca93ea16defc24b1ebdcf4267971","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-rc.3","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-DR0Ptl1w++werPO6Wt3UpKLILes7v7HJfBkiPFTNP39zhTUHWF1AejM8ApaHLBzUq7g7mDvwbWblhc4QTfaqxA==","shasum":"eb523b32b87e1d3f53e97f7fd1ec46f02046f55d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-rc.3.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh4G/4CRA9TVsSAnZWagAA+GcP/RyQsTcx2UVtOJ+KzhEw\nCkPXEqfXTAmK8r5pTFjTDmB/HotCAqYBj84/44gVQpulLvR1kR7VdjPq1i0m\nB4Pqvt7BOYBZQxA0fLSiCrmRP4wWgUBbPaaym+onFBRNS4dMzFHAvkB8hkwQ\npEkUEorqgXydRpaoN8if5vXtuUVz0W0FAT0+TumxPLEQfU/WBzb4S67BfYBN\ngD/ESkKVKo1Nx7kuGbwVRqnAnU/pht8/Mpdwhm4ihLqFE8PsWe8iNRQPz7Z5\nqQQYgfh3H7JBROgIxlGxBwLcw8EOfDnHokgV+piVATN7hsgJI8drbGLaCODD\nWGhjcH5Yds195ZU3LXX9FCR7Xu8fXFTGN4CJYSKnxvHiDYGnRylscwi6K9Y8\nrG5nZ6PQ7gE3nwuWrzTEjcUoeP8twqvjCxTKo7KHb4CqgbwNniq3syQ4N+Eh\nWy1pQkRLkNGvER12tfB29AHy/BTNZ4gpnB0WFYbmMjio3zt8mtYW0wPmwtk/\nloErfiDuO8sD5fM2jn4FIiutbkaYG1gA4i6rvDZhAQDgb6wdv+3ZL9uMTOIu\nGBADlbGZ3o8Jjvlm0Gqqj1xJXy7kVU355HVuavttMhIcfjCosKkSJdrIZwwR\n9ixgMCMOV5SFCqP0MLDDBI6kTXWBjySWJPX8hKFJu1wObFvVmSDYmbGeYxFm\nX//x\r\n=fMm5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF+3gextFdTdVBurXK/zjj9MyUzqeFDVv0uS9jlG8S/+AiEAvHEdIuwhOUSuJzUaUPhKwu+mZhMU3hsIX9XAzpOJOOs="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-rc.3_1642098680399_0.669887663766342"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-rc.4":{"name":"ipfs-message-port-client","version":"0.10.4-rc.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-rc.4+902e887e","ipfs-message-port-protocol":"^0.10.6-rc.4+902e887e","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-rc.4+902e887e","ipfs-core":"^0.13.1-rc.4+902e887e","ipfs-message-port-server":"^0.10.6-rc.4+902e887e","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"902e887e1acac87f607324fa7cb5ad4b14aefcf3","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-rc.4","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-Tn8bu/9wB0xsR3KtphVQYsVzBsP8eR47af57iyyeAzpFtrULdnLN6MHBEo65lmdfVFKp0ppqTcCv5EOwKjay7Q==","shasum":"8d2acbf67966268ab5b6536493b60a416680ed4d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-rc.4.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6XEdCRA9TVsSAnZWagAALSwP/39FKdcMHwc97GHJNS0e\n4TE/gC8o/mKD3KY06x3HMqZu1EsEVAufvQ3K4kE/2exI74125ML0rOUKk8St\neJJchn1fpJCz5XPDqRWIH7NG2mXHAo8ERohLJJSAT/rp6ZMyA2SvOaFfi7uN\nbp9H2GCa9KIbKSgZar+ljWM1tA5mvzUPSlhaiFRCx1H1a3WrFwjSztxupmgs\n51H5I3ci+6j2NCIZBbpwSKvc96vRhJLLUfQYHpW3gyM2wnl6gCY/JBC3kMxB\nZcEaliUAhtwL7NorZ2GehGAwBh53jcdj2QXge2OoFCmEuomvLleoh94Gyb1w\nU0Mk2aHq40XChYCVHwDWXi7U9lu5DUdic82o39RpJ9J8bJFJUECjwqdWF4DG\nTwXNSXKjoCSKgOMZhU2SUP5x/nUqYKX+YH6BLWO6eyAPTUcfms/CWdOJUV5F\nrpikVLmrqp9G5EPnRVi9B4HGNxwQo2dJdIg89uuvbwgULyBmtojUXIGaSSw1\nEdk3qYZlfkw86PYFsXDM9ZHDAzv5S9XnCf4C7EEjq4rOAgZ8Vaq7UYJLkebh\nXQod5rbK3KiKPtNJjyJ+uGFSj7y/HCBe+sxerwJV5VAH1QZ6ik0j+xmM5vZ7\nYJmHPTLfb86/MWF2U5es1ZQQcyWPoS80lXEJhRJLAbjmm0JWHmJwGHRqQUnp\nQSYX\r\n=xIbM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5Wo3L3dvVvzQkvBmDaHDZq47Pl0jAnFZqhK400pwjHAIgbHHBMLZGwQHsN75eC906LDw8vBbFXq6YyxeaFIIQU1E="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-rc.4_1642688797602_0.14557838708382476"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-rc.5":{"name":"ipfs-message-port-client","version":"0.10.4-rc.5","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-rc.5+b9382bc5","ipfs-message-port-protocol":"^0.10.6-rc.5+b9382bc5","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-rc.5+b9382bc5","ipfs-core":"^0.13.1-rc.5+b9382bc5","ipfs-message-port-server":"^0.10.6-rc.5+b9382bc5","rimraf":"^3.0.2"},"engines":{"node":">=14.0.0","npm":">=3.0.0"},"gitHead":"b9382bc5bc7341a2771a69b2386e5473b507caf1","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-rc.5","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-69qqajQwWg6AzCYJvu2nZ54WqKdcGoDSCd0/WV58ZH8jOZGna1igQLRVPBX5AqWaDW3cSRGgbNNC1SRMyvzeWg==","shasum":"bc847c6c68dc8cf04a4e902d341e26b49774c072","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-rc.5.tgz","fileCount":49,"unpackedSize":151977,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6tVGCRA9TVsSAnZWagAAavYP/jE4XpAsiGogKK80sMDa\n/SCxPKMvfvTttnnXzjsZelMS/v9cEHsbPkZGBcjmzzt6feA3Sj0oIQeKVcgR\ngyS6owuNQqQ6vp8nHJUalcaD7qkSqsBunEeNdHhnofi2BTWuCARL2dK6jF98\nxqWHlXi0nO0jcEbOtBSRkIrLt5DfsGD8mqWcpSURvGnr3RAIesAVPy6j6GN7\nxpxLOoqT6+bh39CWECl/MZiWtBVzP8r3TFCbd/Z2VVdacGgVEb3TtkKZmy5e\np9/QUGjgZkHLWbMtCeTh6VwumgQbebEn6jmUngTaQ8Af4KO9xJ+ue7u4FObw\n/S4x1zUxT1yqbBF0PQO+a36Ox8Dk/SQ3k4FDh5/KFertlNrEhU5drCaS92ld\nCgn3W22UixqsVZTB/ShrZLkSjPNd41bMLIZtD9V8UbHBPN/tmMJbhulWw/tZ\nnFbG+DC8EBdqQn2ZXAW9YU1OHVth/+8pZnPIBl/ew91L+CP6xXvgiFPb2ecq\nP69Osug4ajmKyI66xsz0cQhIrxCF4mCoYc5aWeK+9S2Llwp/V78hh0EQ8/4S\ncwctiog8zjlS4khX4OZ2CJm1HGN30hx3ep6h5/5ydV6hKc4MGm0ndO6Y4keh\nROXnwXPRgigFCg/oNpQafgtK3JY8uxuG94KRAGbksbzOFoIOn1oC4vgEBYT7\nTVJ4\r\n=ELr7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDaWncWmPZVo6h52OMSRIBxKabgT7GBZkH8u2iK4ENjEQIgUvZfXLhsnrNrzQAPTfpInctYlmqh71k8XVI+jnYnHEI="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-rc.5_1642779974378_0.9989283134805069"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-7fe0da57f.0":{"name":"ipfs-message-port-client","version":"0.10.4-7fe0da57f.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-7fe0da57f.0","ipfs-message-port-protocol":"^0.10.6-7fe0da57f.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-7fe0da57f.0","ipfs-core":"^0.13.1-7fe0da57f.0","ipfs-message-port-server":"^0.10.6-7fe0da57f.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-7fe0da57f.0","_nodeVersion":"16.13.0","_npmVersion":"lerna/4.0.0/node@v16.13.0+x64 (darwin)","dist":{"integrity":"sha512-kzPUpkOvgCbny9lIhC8HcLOj9ZKDNr0LFdZOTA2euiNlUmvxKWNep4AReVec6tUB7srhPidjYxsnseDpkCzQrw==","shasum":"d5186fd16ecb17236ed5ce4f6ce346688e4a363f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-7fe0da57f.0.tgz","fileCount":49,"unpackedSize":151908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8TsFCRA9TVsSAnZWagAAEJQQAJnkpFOsTPIaNHc4tjk4\nRDpg292n97mKjwsMmkErmyZ/re42y9D0tul7KDAkn+18WUoQrNzkMohyZZ/c\n+8BqJKk3bpZwsd58oKP8deNpU3evmOYmHCBhWJshljU9FP+I0HC8+KacD7w0\nVK7TDI1W1jcjvPr81PPWq50LEz7HhZLhdF9m+MxUAWekVD26QmJ/PWNosgEI\nqVjpt618WG9qKNOTZuiCyTz00WHk5HNmqdXrhM93EfkHwgT05e0VzNcqbPk7\nFp/Y07+C4Jp84HC8OUt2vui51BvYAK5yysYrvvm20uWqPLrWfgcA04H1fqZu\nvWkyhtxjo+2cJj2620D2M+Zg9hfxHxEMWAuKgZdZ228xaEsqQtB73YpDJtey\nuO4hES2sTg0kwA4KwhBuzKKTZatw3oB2lb0hqDccugsOWsKd2iikmkd8dUgC\nZJVY6xDj/AEX6vfW87fV2/fhxJpT+ci99N3MCBaw1Y4bx7Nq2HXBAy+xy3gB\nmbwlYSWk+QBBoKSsSWxNQ2YgHg8jnPjAFPiJrVYGudL2vUUZfEZrjq2lPkmw\ngm7A8IDWUs4naUf8OhGCLZ+9ZuNUoJmjdmp+E1yIqmn6vI5wzSvOJiyszWPu\n0FH9Z7bzj0vPY8mitdJCnfRksOGwjwCDUG88KwNu0Xvcvu3yzUV3B1fhjQ1D\n5oSA\r\n=NC5k\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIC8ACF5tk3tmck1DjYWtuFcIisHFIr5ppL4WOf95iwwsAiBv1gYqXI1A1NIVXFv38Hiq5vGREuJRdsbRAnrWLwA1lg=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-7fe0da57f.0_1643199237348_0.31722531190197123"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-5439a0e.0":{"name":"ipfs-message-port-client","version":"0.10.4-5439a0e.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-5439a0e.0","ipfs-message-port-protocol":"^0.10.6-5439a0e.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-5439a0e.0","ipfs-core":"^0.13.1-5439a0e.0","ipfs-message-port-server":"^0.10.6-5439a0e.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n\n## Lead Maintainer <!-- omit in toc -->\n\n[Alex Potsides](https://github.com/achingbrain)\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-5439a0e.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-PJojCsA2lhEkHh4gtneDpaqinx4t6W9drRu1lOPRbPgdyQlqmyBY/hx8PjRH7q7u3hpfKxkabM593GMDI8PELA==","shasum":"f376e93a3c800c9017c80f6ff66a09c812a4d022","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-5439a0e.0.tgz","fileCount":49,"unpackedSize":151896,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8UeYCRA9TVsSAnZWagAATjgP/RfjpiyoUur9hViWA0WB\nURQOkZcYjP4XHrxWxOeOv4mPARtGPzEpNEndv1gJcDbKHqg+ppb59Hylg5Vv\ngRNvX6odRsfmc0666Ond5rQhGFYs+dGPKVzLDVjHWcJKUZJPXxYWj8tpqC4u\na/tI1kV2XuyfsfStUJBGmmhNrHiRg/KU2KXUR7mnGQv2dctfzllAzLOStFuY\nmyn3y3xBI2XES3U7kd7kCKnEExH0la1XoNzU281vMOBUTWIKGwCihtdbWleo\nXFflcBaLkOs868dlWFSscpSVAZ+WrEM/vv63+w3dLooneCCK9hxlw3oLFGl9\nfEjAPoExdznbUs0U9KMHy9oYKSRv1YWnEb8WyYrGxKVisiOncAQ7gjR++uQh\noex/uY4di68Odo3BmWs+B7dD0AA2w21VLmdNvgdqYrVn+qrgaUUGioCqJ4CV\nCH6Zji8Z5jwDhRRB1l+q28yMJfPVZ/H035+z54YHJmF2+vDYgZTo97zcCF60\nxGY7dmF0GhDrroEOiQ4y8ONBK/2PkzX1kdvwtPODde0702Hz5nLeynGhgZkD\n5n7RJmCipOYpWKBXNHhOJwzrONCpZBwC87Z2HRPvK9q8UbnrhQnUAIP/j9BP\nUTKBQ1YxlNmOobtfKx0SGn0+oDYQXb5HCu4UEoQSAefPuosy+q5wXoXjZwwv\nWp9C\r\n=lM2F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2k6GleIOwBPcTBThQ7HH9EWBLL2vrrW7BvCS/3dTdpwIgUae+ULJaz+MYkiU5Jzzd7LYX1kJfVDvbl5urpRQz7Kg="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-5439a0e.0_1643202456735_0.9881175678289378"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-a6b201af.0":{"name":"ipfs-message-port-client","version":"0.10.4-a6b201af.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-a6b201af.0","ipfs-message-port-protocol":"^0.10.6-a6b201af.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-a6b201af.0","ipfs-core":"^0.13.1-a6b201af.0","ipfs-message-port-server":"^0.10.6-a6b201af.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-a6b201af.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-GRlOGGFqhfjJWZ7otF3yCfei2qJpqgglxxb/1T0KyE1VuzTB9cSzDyKtJ9x8KZJ5THtJpsa92j2VPyNXxLuszg==","shasum":"b2974e28f50d89b78b62b3cac170d218006960d9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-a6b201af.0.tgz","fileCount":49,"unpackedSize":151811,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8rw4CRA9TVsSAnZWagAAGcIP/1N33GSBmHUKM0AYZWjn\n7Fz5J2JuyyhC8CwXKUna7e2ElCFvVei5bC4oAqXiTk1jcG5Nv1VSJ9QngoFB\nLg9xu974GEZMNTzS1hvYpi06vpn9+8wAYQbdgts8E3S0jTtHyLMMGGliAwfM\n7QryOgKpSzok6VEE+mekF8qbxonMEXfRF5x71u37kLuFFqWqHUluqIwUH34K\ni2jvkOPbytmfofgwAj0IvM9WWoDK84ibUhphID5D0ttX8GmDpJWtZjkAMYWF\ni22eFb4WvVfnvdZBXZmdCpu6HeysNqn6de/76CWVHyySEbNno98h8/vA0eis\nNhYiYBzDvt2D0j/3BuIxeLxtyxWKFargd3P85odKYIMamBh4fg8d8uR45xD6\nUqzBRGAZmQ04UgmDSODfUj6O0T0LESoU2u6EoEvbE3WEfTHJlGB4iYyieEES\ndu9096dJOWmuHAfqJ9j0JKXcJXfAaU/swmLPdzNCUqQZQSQY7fVX/ZdUu1LB\nrQfki4SuvCBTs+x6mtLEQKXuubULknB0Qt4TfZP+7ytMJwA4iXpbvhlGaa5E\nv10f2M2rQ6/i+26Nm+8bUY512cnsChh4JEgyTJcVPO+dXg/1J/dEPdrda6/9\nZyT+N//IFdX1FBM8DKYqzu3sDV9OenPJvKcgar+Sng5iy/4OmnH2YhzCM2C9\noJRb\r\n=LY96\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGru4G3PtJKGZE6vL34JO5lsMMQDtiV2SxhCI0LH68MkAiBeBSaorXuwqCn/W/NjhGEKqnwXDZHB8t/Jl6Tk1RAujg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-a6b201af.0_1643297848038_0.0096981234554252"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-fbe14923.0":{"name":"ipfs-message-port-client","version":"0.10.4-fbe14923.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-fbe14923.0","ipfs-message-port-protocol":"^0.10.6-fbe14923.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-fbe14923.0","ipfs-core":"^0.13.1-fbe14923.0","ipfs-message-port-server":"^0.10.6-fbe14923.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-fbe14923.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-7MxsKfaoN4Xif+0ikPw7upOiay0eFJMII+ApRWzmMTckABiW/oJLvL41zQQ520/IAz5erO7tRqvQDiPlSs40Lw==","shasum":"1c8fda684759151221711baee618b632bea0b820","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-fbe14923.0.tgz","fileCount":49,"unpackedSize":151811,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8uG8CRA9TVsSAnZWagAAODAP+wa8CMNbaj8/iM877+Dl\n5UL8Sww+EAaVyXPLIJawpwslBx+3I7CB3X1mz68XtHok8WcIS5iW9RORVaPy\nKT5kHwiqQxNKNS8fOYElgayZuJZjXVScuVCUE6rWWPmJsHUVdK5P6ABUaJze\njV8I64Xa7dDIu/Qgqx5fBekPFwNadB47KzBLvRi69x0hKTac3ILfU9oAiLPo\nMR+YmuePnPpbyQ4hXGiICU/lhSnL0/Ku3CIdxlDbN1/83ZkVLnXJKHbUmo1T\nD4gzT71nP204r22Ldbo2JuNk2JHjd/VZwjA/x+rW+OWtYaa/55y9OtDlzGu2\npipLW24fuIJF3NKm/mdXfbcaLW6bMYt1xb9XT6h7he3Y24xdfLw6ICveimDf\noa8Rf275VCvJGfpaTnC33MxsZJOtMqM2Cc/VGSv/RfTqRXwKJ38EWvcASMEf\nNRfi6j2vKIj3jNvJNkB36FF751t+pS2KyacgbYkw047MGAKrRw5w8F9des6I\nv8+SJEjmDU1yCy2Mj75FR4SRtRU7KLv2RtNxypH1i9WekdBBE6GkpHloFBnI\ncfTgtEaNcZyYpRGkrsnQ03jxmJO+ta3rRLldzcvmez9uFK5h/KQI8rX4pww6\nONIWJGzdYRaDCpmUcHiVpq7LYM1LYKELVGVlWbZ2E3oTIN3KK6vXXCcpGB48\ne1dc\r\n=kZFH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4DE46G2xs0G8j2eoS9eivCp8nQr2FwzMisCr7+z3H7QIhAI8yAY1UwMRgvmD/92NdCSp/8FHWZCEDC6Ezc2CCYUkF"}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-fbe14923.0_1643307452284_0.8984852309685154"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-6cb3a87e.0":{"name":"ipfs-message-port-client","version":"0.10.4-6cb3a87e.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-6cb3a87e.0","ipfs-message-port-protocol":"^0.10.6-6cb3a87e.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-6cb3a87e.0","ipfs-core":"^0.13.1-6cb3a87e.0","ipfs-message-port-server":"^0.10.6-6cb3a87e.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-6cb3a87e.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-gmNg9CIFw/v524P4yf3l5YR+IqoymgNp2Us5WxGJZW5hPN99m1xGyOIk7XycS7wpDpvahJUEMkRcGp6OMHmIxw==","shasum":"8c0a0790cbda28a604290f43bb12f132d78e2666","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-6cb3a87e.0.tgz","fileCount":49,"unpackedSize":151811,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8u6uCRA9TVsSAnZWagAAwQ0P/isJFB6zEl0iFgYGwYgJ\nUcP5/caGhGMH7F8hJoSSsXqNaUcaTgceg1T8Ohpb7VjyGFvBI23c/bIIQNGs\nmN16Rm73saaxxVnwD6SXIRFrPEjjj53GAHazNWQDmPg+y4PBDRR/2lr7k3XT\n947n/jK94Wp3OddBtuCzcOl5GSjdcjQYKqj/cSSwbIgfayhrUV3x4mDkjpMo\ngb3QdGbi1yKfFpdxLXET4KeiKldist7rCJmxQtr7z+nVqhSg2vKpvldZEwRT\nSqaVKsVCRUUFqc0Cvnr6QIUbWrBDwzaryBwJuFljTrjSVgplRxudAaQemW84\nkzaibKcijQche2FDT4LoPf5ukDbi0Fv1uqiOjkH9TUX8ZjqsCf3Gm78VLoeR\nUbByoEaLjY0GR7uttVbxmOSvD9lg02TutqymwNG71VJYUzOszYla6aDORFTX\n8Y/uAEl/diJxEJe/6+5i5eDVX5WCKFfVpEqeP8iJJ6sH0Y5EHuo9QWNMhe6v\nAao4VasrrhXtcoWPLIrUJ7cxqQGAOcxKBS1Cg9srH41YTjqTMJawCmK6cqz7\notJ6x2IH00y34eGXvsNvOobL/YU6ZEvrf4QTIWlXV/sRyp79nj31x3rB7gwn\nb3WNqw01G1cQ47LqtdEvDZaYqv0EfCFt0n+UeRvDZDZ0klG/NlUMPP6MNmtg\nm3ny\r\n=QpT3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICsM6Bwo56FBQLwdEDCehBO//l2QHJ4RHwxR873M9CshAiAlQ1JWKcJBJ9nke1yDcJob65ZW5xz294/jfscK+XHlzg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-6cb3a87e.0_1643310766233_0.3639037303764021"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-2afef2eb.0":{"name":"ipfs-message-port-client","version":"0.11.1-2afef2eb.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","leadMaintainer":"Alex Potsides <alex@achingbrain.net>","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-2afef2eb.0","ipfs-message-port-protocol":"^0.11.1-2afef2eb.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-2afef2eb.0","ipfs-core":"^0.14.1-2afef2eb.0","ipfs-message-port-server":"^0.11.1-2afef2eb.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-2afef2eb.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-S9tyt/8HtULBrWzOFoUmWNXa5Nc0gGpzx5KPVHEj/UCdPVPLCgdPdXJBetsSzNmD/wTVH6fhAd7icl0ZfhBQiQ==","shasum":"c31b0c9c55a1917b5c4de63e3d7b4ffd6a35e71a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-2afef2eb.0.tgz","fileCount":49,"unpackedSize":151812,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8vvdCRA9TVsSAnZWagAAR/0P/0Nl2yLmkJgz2l/kixpj\n8Ct/F2+iMfTcgFKqSn2kK8662fXxfj8JtoabDYVUthZ7ZBf65Cp84MkHgsHn\nfIgHiMMxnl/rCeNIj+DgtPF/xBI2bLFL+m3zAR7d9NOGsVxJDuY/SqVtR+O9\nQ6DP8DVCvw28k378CW8jG5b262/A9uJEPSlTb3+LIDvbOkn3vzQIWwK5qH9X\njIfWVwTh477gP7XaVmyhKE5P5LJ/csNW6J06OC0jOSZmwOL/L7mEpde9t9i8\nLc2MB/QjMpH5z3k6ZYXSxm+0MfCjirKsGonWHIz5YrVbEFW6qHNc84R8pV7L\nH9VUpol7YjsGUAkQIEn2stFitDV9OK/K81KOhnVWpZ9J2KqeEpP7Av3pHySY\n0UQIwiTtuT8bNfEiECnp03GY8bJ/9wcmdsVuYlDZRUJgn9JAvnuoZjUnF/Ei\nlN3F8H/Y9Z+gAPDC4UmUjzzoLe2rtFvEhtEC/vNaCkZJw9bfKmwrOS2MFv69\nzIkStD/pkysqhBE/dt1QDzLyOQKxwNrcaRsZwxwv1AA2cY65HA5ejaNEtXUL\nte2+Yt88zqzyaCPMcbsnRYmyExy8qvQpYUq88+GRA2Oexoa+Z2QUpCnzGdhI\nIr+7RReOjVe4zWInhS/oDDHXQpKBO/dy0+vfGS1GXsqQVZiUewXSKlVnATmR\nbWxL\r\n=v5uA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCr2Czr8XIXIYDvfxeWg8x4LI8TTJStR0flWCia9D4/BgIgewfKuwaJPoPjNRAaiagSunNpIN75bpgPYg+6e+q83YU="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-2afef2eb.0_1643314141158_0.27779776538359235"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-3a5d61d4.0":{"name":"ipfs-message-port-client","version":"0.11.1-3a5d61d4.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-3a5d61d4.0","ipfs-message-port-protocol":"^0.11.1-3a5d61d4.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-3a5d61d4.0","ipfs-core":"^0.14.1-3a5d61d4.0","ipfs-message-port-server":"^0.11.1-3a5d61d4.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-3a5d61d4.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-fsamACkifYJiDiLzMqH38jgkPwSYKfPaniDZPSf7cuJdrfMMBpL5N7riVVLNa+ycbYQStMtyCUbDBnYukkxTzA==","shasum":"d8c294eb9fb2d68b44fc908ed6177f22ff12662d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-3a5d61d4.0.tgz","fileCount":49,"unpackedSize":151752,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8w+3CRA9TVsSAnZWagAAL8IP/3xNfHdsuIV4cy3N1Jfk\nSjbB6vcr4UxjIPtUB7risMfgehmhlzv9uOH7mORxcz4HaVyO1K4yDG2+6f26\nHpertlYy5u1bfI9gJxNJe5A3XynVuK8WOPptBBk+JhSqQqjJA8xeD/zZMNMc\n/UGswD54FjzsDZ6vIdBf4Uqtx2qkK2mk/frkos33PQKWkKBRx6eFe9ep6zdS\n5NSKfuiMhVwQHX59TlKEh4LeSK/YKRoOFMBubAxJeFoO6F/IbbrBNNO8YBFQ\nZmHarZqgh+0S/WFMUn4rkpkQjamldPG5v5rJHFXkw9F7MNIgF91sTwhP0SVb\nep4TReUDliB12son3x2xv8PLc+MsRDwAcO5ujSVc7GjSyaeQ85uk4sXHBA7C\n3c/UP4T4gIE+EJTaIDXjkSK63OVBSQzeH68vWJ3wl7E9YDJtT0rWQV2/OMJI\nc+STjsD85ommqJ8nEsLVZjfYy3hn84M9VYI2MehrGb1hkb2CkDR0APSfiffF\nhIIEX57bhA8h5obOqe3HYGLFs/aIfis3T0W1dTH0lldpY9uQDKpkzUzyPU/L\nlcAl8CDbZTkQ7dovDyHp/2UWoUiedIoJglRKPm5ZwJ0Z0a93GkVIY9OVRtEi\nLS73d2jy0hekKdruCt6AUKj3MKyOjRDCTKqUyRbOpNPvNQhh+fwrqFA3mnmW\nAJII\r\n=940V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF6uhk6wbIuXjf3B66Gqa1RMpuXdn71NtQq5suBA8gKEAiEAxMPkgUVSUj8hlsbRb3pR2uqLIKDf0x3eUX9upBIq/tY="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-3a5d61d4.0_1643319223474_0.19320366241680698"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.10.4-cca6e321.0":{"name":"ipfs-message-port-client","version":"0.10.4-cca6e321.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.9.1-cca6e321.0","ipfs-message-port-protocol":"^0.10.6-cca6e321.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.153.1-cca6e321.0","ipfs-core":"^0.13.1-cca6e321.0","ipfs-message-port-server":"^0.10.6-cca6e321.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.10.4-cca6e321.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-HnEc63gGPbJFQiunI/Ql0AOfI+cpVcBsKQqiCCxsDbjNK6P6MdDREQFP2ycnPrI77Neyyf6YN0qvG+dZXk2irw==","shasum":"c80786913e49ceff088b574f9050697958d3dcae","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.10.4-cca6e321.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8yTVCRA9TVsSAnZWagAA2cQP/RqCyfK7hxzVxRgBflmV\nmoXlaYQEvP5gi4luA0SdGiYdYHSy+F/zdQVApqkcTk0VXjoZvi1iTlnLyAoe\nGi4jRTIZ5GMF/dQrs3Xi0dJbo9tzWkaIgKo4nwImoxBRg4ivicxSePfysvKe\nvfLuzDkMBXvzmG9O6yMP2s3tRaxBU+Js1Ip6lDz4EgawWuBTNor07dHE5RHj\nhstFGlICrjF478AuWWZAin4VTQ+YSLD5D/UnpR46AkydFPjHirEqKJK0FB0q\nqz62a0yv7pcu8phm6QnT/l6blxRZ17R+OnfJNJz2iJj6+UO/DxyXz5eiAaiQ\nWGguAgs20aVt9m0But1sT0bzykMvW3+SDgwAL5zkMlOhM7paKW/bPE3HByos\nPnoAWILSxvSgnp1X3F3mrYmgAC8GBl2P6pkdND65N3Z1byRkzHY1hj6GK+2+\n1J+wQSFuGV0WbHEEeyc531Y0xUvXG19748KsLNO6qnX4Wab0FS8bjSapYCCa\nLwl/rDn2K2g3wmvpyc/+ezb3psNJabUpw6W2+CumdxLCtZl+l3ESQKzWH7FE\nsTUePEUJhg7WxIln1cAmi2zwIT+mfszT6q2qoacF2ckDp2buN3KETDIrVRMj\np2o1tdT5eiKxbc+P9E2aNUm24WyzjF9N66MUGv1CzbSZkQD2Dq+ahAtZJr8o\n4p6Y\r\n=yvgZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDDBUY1n/QvHOv5YPgzehrNOYw8kcgtOPqQk1hhb/vfhQIgEuqsaMycuPOWd1HRiw0/L6K4ZVwELKwCOJNCgdBEoGk="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.10.4-cca6e321.0_1643324629490_0.27781898023487095"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.0":{"name":"ipfs-message-port-client","version":"0.11.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.0","ipfs-message-port-protocol":"^0.11.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.0","ipfs-core":"^0.14.0","ipfs-message-port-server":"^0.11.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"_id":"ipfs-message-port-client@0.11.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-tQ7+YKgAR5t3+A6hwGwknSrDrwP0UPa9DNsbHne33vCRdBEFV3vV2ipDNuf4jOybm/XNmIUXnhR2xBWa4dMDFw==","shasum":"2d59086d8f0cea1614ac53c343bf563196c0fd7c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.0.tgz","fileCount":49,"unpackedSize":151686,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8ygiCRA9TVsSAnZWagAA5ZUP/j+wr6tOaHyjyrIMvoIF\npkhmut2NswkEQaLxkT8gdenKJZrN6fRP7UXLERFQGr5ddvwb2FbfUxW3LYIZ\nYCaNhmixi+vQDC0NUVNLdSJFgCFjBDr0GJVQVnv9agUXTo9wxYH2aFGcwsdH\n+rXQEuVmr+g0KeQuFqnvkZIieuDGAT/Ymx3wbg71sCuU+zIm/asQGMnRvd5o\n9gr7RiCSehiNTgtgBKgwWyFCqXI6w640NXdIpX7vCGuGYqz2eiXZkWCMggFq\nWtjIwuKWpsrNgoH8bacQ58GG06eSnHYVXr6hyFgS64n0V4hiG3pj+mmjUNur\n9EONqm7SC2QejM/bxsAZHCmwid/O8MLwK1tJAx5020adF7fhFW1XgfqSpMX6\n3B9VOX0N8MAr4xq77+EGkhEYhmnHQLBgFmjB6HO0ak1Atq1chF2LGCVe1+Ph\n41yspjFXz46ywso4p9IPxAC+aCLed1mtpEVa2zoeBcMR11l5zM0ZNzDez50L\nbLdCpFZSeoqug3dE0bZKfeGQJFFVvO7bODNk2c5NF9HVQOvJYHcHvoCG5vOD\nrUg2epZfyy4yr/nCEnkv90UIIeN88axlsLmlOXHuImPWW7C5U1hpdhsWKcuj\n19IbgYYXWwvjS8fDUCZpkPYLYJknHd2eLnwJ92+vqKnZ8+4+1cORnV+sAL6r\n5RUN\r\n=thZH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjTRvaQy4E5YdtcxYqElZ/VYH1BLrwq8O91u2esGISHAIgVDPQ5qTDW453IjglwHj49XHBkOw6cq49OUOcDQNhdns="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.0_1643325474663_0.981730569144885"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-8d260215.0":{"name":"ipfs-message-port-client","version":"0.11.1-8d260215.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-8d260215.0","ipfs-message-port-protocol":"^0.11.1-8d260215.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-8d260215.0","ipfs-core":"^0.14.1-8d260215.0","ipfs-message-port-server":"^0.11.1-8d260215.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-8d260215.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-pyMRY//Hgdg24u4flabWj8yi2Z4M9Os9aDNfh1DQsA/tsPVKR3/46xlHj+dZ2c5e/sTyrhAX++iERmF3ZZ4/Cw==","shasum":"4a94ca8d7022a3c6bc62af4cb1658323ef519272","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-8d260215.0.tgz","fileCount":49,"unpackedSize":151752,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8zBfCRA9TVsSAnZWagAAzs8P/RjLIjXcVG4Wh9YPbcr1\nimqTyLSwTL1VbGPqdOCIne0ZPcN3oxaT94c6IETPwSD7owg39wsnGGZZUEEp\noYtXoHgaRB+0992rhLu4kPkpqiURTCblCJRJFzLhpRQMrB5sH/2yKoNgV+Jw\nDyze4ekj2FO0Tbpmxv2xQX2M/ZtcRiJqEWx+q05dXsamnpFNO9vglMaQiCbe\nKWFLUZ5sMFsT5+swg393hti5pXxG9e1s3CuKqSl2AZ7jH1YK6mubXjAbMDD5\nJGe/0M+QghrC3rhjpu5iEocdOSNo05urjWRBJAxq9yi3jx7cpfUWK8NoJKXq\n7FN9dRskk27OVMT7pPZk73pge4WhWfqHEg4E1gCIROvNbZlpT4cWtiR+SvFV\n3RWgihQyfH4Pv4cMoWRWKAdvNaINJNXiQxQc0sXJdKqrcMyHrRLBuGF4P2VE\nKi87JUz9Po6XEQ8VjxEcWqdv/6zgeUxnU091xNjzj7wmnKr4qT8LAhm3zrqV\n38GzV5DEtlSKF42RWXDsmgd02b4KK5BCPEF8HTz2/GcYAz47OfxUG9P7lm0P\n0H0t9hZxi2ksy+hNlms4cO4EevIYaqMzLgDfaH5e01nrqKUIBAl3giShfRnx\nKScg6tYjAW7N/tG7DCrAk+KyuRdH5zt2dMhQd1+pYmKmfATbUKCncMjP/J+v\nXb9K\r\n=7KBd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHfK3BseF3G1dwCy+KM9ylUe6KApyGPPD48cInikn93DAiBJQF3bc0Vrk1pxHpVFm6l5S/XgwKq/gnPuIyMZHIGK8A=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-8d260215.0_1643327583511_0.6690356229831527"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-2c8ec080.0":{"name":"ipfs-message-port-client","version":"0.11.1-2c8ec080.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-2c8ec080.0","ipfs-message-port-protocol":"^0.11.1-2c8ec080.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.4.13"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-2c8ec080.0","ipfs-core":"^0.14.1-2c8ec080.0","ipfs-message-port-server":"^0.11.1-2c8ec080.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-2c8ec080.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-97+SfTA7d14kLBap9u7dQ3Q1xmneWaA3muWQwoC9e9s4lksQOZdwXzYCYjYXfDyDj0jsF1i7H3YmMXAfHWcvBg==","shasum":"0b080bccdeddd4d2bf72b576a47e463c58ebe511","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-2c8ec080.0.tgz","fileCount":49,"unpackedSize":151752,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh9AQbCRA9TVsSAnZWagAAofcP/RPOyfbykR5wV5mrobox\ngs+QKnyhrC+yxXJxsP6YueNfu41w3OeIvXlHLICmr0I9+aMqYyku7dwunS0h\nJrgDvxiL8B0sd0Atqzrq4UZ+3uzOk+Yt1EoSQjYSSANbFSAUyOaLbyfbJSmA\nmyQq1QLzjbFZcmJBfcK8stmnPrXOGFVEgc1qeVB/qckNrMdg7J6KdFt75N0A\nvEzS81he4/8wZO4r0Vwda9T2WrhqFP9VDJsSB/nhfkc8xwGx8VqvIFkjNE6X\nZ0gcC0gMH9N4n9D53rMVmvnlgBjKHlcyMI8NSh94rDhhVXAYDBA/SBs7+f3D\naIB5fA1yZVrOM2rGAGDxGEa+z1/KbOuA2HFZRslwvcp97tJHmM0dADM4fmML\ntHNVXnsDGqrmuaWwueLXOwtFW838KsYk9RuR0TvYTNMGZM+Z4tR8F2pK+8W1\neP6QO9O7Sax07sxPnQLpmYz3WDxYtCNmP6rHcs9DRn1BuzaJRkmD12lPVwYC\n9ZyfbV/ve7pHtd0qdOEJXoFa1ivhqswMrP6Bqsn6bmWjq1ocUL1gIDoILOhl\nVq7vOvurFKQ1u2Zl4rPTmzGwyk4KqpJTUpszaF+RFO3ftJeBYwMxPakGs0Pg\ngb/eGK6DBsmU5P6i1KcB4seqnwmKDHc0OOUEeGZe/AbD8o86nFjf+8DUE2lG\nXrAR\r\n=mUgb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBkkd5RRlIGoHhEZgURLDqOgb+zxgUnsdr/VFempihC6AiA565q6UmP7B0pmTekY+npildxe3MjyvDrW5cf0nkUajw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-2c8ec080.0_1643381787052_0.06250461836671617"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-3a74c110.0":{"name":"ipfs-message-port-client","version":"0.11.1-3a74c110.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-3a74c110.0","ipfs-message-port-protocol":"^0.11.1-3a74c110.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-3a74c110.0","ipfs-core":"^0.14.1-3a74c110.0","ipfs-message-port-server":"^0.11.1-3a74c110.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-3a74c110.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-rNJbZX7H97KIrehqu7Fs/Zx3wCBy+u8E6C91ZQax7pikkc1FSyc9Hr6OeDexKGm06vTqsAz9kETWHWThMTtiVA==","shasum":"ced921df3efa4a8cc8bc3afa7df9bf6d1840b27c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-3a74c110.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/VGDCRA9TVsSAnZWagAAc/UP/3kxCU2w7ivD7Qob5Ilk\ng9cdVCjBn/n2MhuiCqmlPMHXoJCENs3hvBf7QoXEEJrpXLeJ9NS7HtrZ72hp\niZHNDOSv8zfFNLNAi5X30wZmnkTh+V/gsG7p9HRsxUW7hSQBMdZKkiVySC8d\n81UiiOP3uBDl2+JuiawaU4FZA0vq1sSYZ3r/+L52vO+7vsZVYyLr9vElJc17\ntpekPvaQnu+erra/zfQsT3BSpTjX2MVJDlUl1V/DwKf4l8Id4Aui7m+hIxat\ngntzvhrL49fjKZ4w9fQCS5mJC4EvQ0Yd3j4LHAmmziD794CGU4ag1HaDNS6o\nYMyqdw0YZWxxPzSwUP66/aoqwRpYNtrzEEeACxXxE+OYY0CX8grXqhowSh2U\nK3DT+4HMDHkk5qpadwdGMAE3KLdJGLmwsYxWmBaJACEG6YC+3caLe3T5spdj\nFNiyX6cUUhHjPcbfFpnxVsVxewm3Inop/Ovgz2sMmrjC9AvzkxwawndI18Bm\n0m2ifCKUikcSPzAKBTlkHe8bU1xaNyl6tqVbhvZE8z57YG1LHQ4PUWOCs4Rn\nGnSsf+z3IIrEvdaUpyYfRxbbij1+IG2XveXoXZDsxYGPZRaJz7MSBQvsKp/W\nl71VIfOueGXlPyCUamdBWLrA3s2XxDDALCXVxK5nVEGqdY79qaSryhfI+bhf\n/VoE\r\n=AU2S\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIANQH5iLEq+Ipbu5hC77FEuYdHxI4rqEximEheroaBrRAiEAqD7dTirdnYaBQMPN7VrqdZK9B+nSPVSu3gQp/GKOHH4="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-3a74c110.0_1643991427709_0.9430176267263306"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-383dc07d.0":{"name":"ipfs-message-port-client","version":"0.11.1-383dc07d.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-383dc07d.0","ipfs-message-port-protocol":"^0.11.1-383dc07d.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-383dc07d.0","ipfs-core":"^0.14.1-383dc07d.0","ipfs-message-port-server":"^0.11.1-383dc07d.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-383dc07d.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-ZtEBI+t7QPFlkEO9KYda/ZXaZhc4YyHR54Nu4INpMr/Y2dQiiuWpcKUvlRHrC8ZFBpMdjbmsJKUY8cRTp2pinA==","shasum":"741fd90723df2591dd8b83fdaa8468c412f0a22d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-383dc07d.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/YUaCRA9TVsSAnZWagAAtb0QAKR/SsmQve2ltrK/gE4P\n2lCi1B66aPdyA8nyWxShP/BWburEDGsf68P+Bf9l0diHjwHBJTqUKsS18tr1\nyGUFfex2cx3/CxgPEM+ngd5Ia5pBFPn1HeEwwr/nYFK4O1wycatCfuAYZeF2\n7GsEHdux3JR+ytMXosAhh+uvnwAhQXTIo8ZglKbJREBKy0zAvgbQlYZ/aBWC\ne8KVuJ7s57RpLOoYqgbnztwn1XHRhJX3ySNZKQNqZ8u36HUGAkUQdpaQxtBX\nI/PmzHQRSPxXh3tADonCSjkjbHPdV2+N1sme0lT8WSEwD3ihmFCeNhtgCpJf\n6AOXVT1gEly2RGiLkMu2WCFc+W+jpDxNb/AyY6F1Acp7qsllSJTI7hyZMwX7\nlTLHqaRjSFoE+uQZcXr00bsDJJccbbJd+/vtBgqoOepFw4683wFciuS8HD1M\nH2cKUVZzuPGnwevfcOJdW/IRqRYGEvtMItdrkfbA23G8HmgFPeEDq22ZZy1M\nR/UAD82FSVdUNBlN288Naokd/VaxrEI+OGU0FlMHpO5Oal9lApimpHLasv8S\n572eaYB1xKrWRH5M1VdpAQ7FCDPIBQbNQuTxzgU9mvwj3isVW0T9bPTs8LjU\nEjO79AMjLlS3OwPnA/5O9bOO/faE7+eILJ5v++4sL4yZ5H9gD6TWIoHKuCeW\n14nx\r\n=5ctC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEjeFTyj6PjfV2nqy0DPi1aZsPMveZ4Yr7MWPUbtV6hlAiEA8/g+1qQzwRajJg3JSVZBboibeflS52+mP01LsWAOHsw="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-383dc07d.0_1644004633824_0.2736691023639153"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1-709831f6.0":{"name":"ipfs-message-port-client","version":"0.11.1-709831f6.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1-709831f6.0","ipfs-message-port-protocol":"^0.11.1-709831f6.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1-709831f6.0","ipfs-core":"^0.14.1-709831f6.0","ipfs-message-port-server":"^0.11.1-709831f6.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.1-709831f6.0","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-7uci3Uq9p9PYp1wbRDcJUihhcqjfgavrgj7kUi3V629W74INAOuZ5+XuOqgV0S6ODQSVOcMLRRk4FecG1RiNXA==","shasum":"bb4da92524a04c2f6c1a8d2d73d4695bff3b8e8e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1-709831f6.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh//FPCRA9TVsSAnZWagAAtpYP/Ry+nRHCfcz1OVB3sJ+Y\nYbVWA0z9iwf94uFhkDk4VEJi2JfvLc6y3gPE+4uH3KYojlCVsIqdA2zye57k\ncfSThO9vnFEeIjJzJ+DQlJykhiekKW3i2mn3EBGJLDOdaUYFcwtwzSyeDZlT\nikeQRL+gtPimTQFvagCg1B1HeIpDjZ0WHdhEfPUfn1tSx+yz/rG6a8IpYiOT\nOjVDJ52yq/eAOquvVrfMYoIrao9Lnwvqp7F9q8A4ln+i1X0SVFFBsKUhLgwO\ncRd754nz4Er+T81v8/FG3GremOHK7k0OU0JGwsz26lT440H9r7iuRqw5rLN5\n7KxYt2LcLwJajByIjLNgRFeWqY01rhMKC7JjJ4NgzxfMGr5oxXK28Yk37iVX\nPMHWazicq4SuxcIYTBOirbEexFBPJSooLpIEExAr8hmsEDl5cItAtd+ken5I\nk696zCq+NvCxVbDOfRNXApOY1y5nm/9ME3cJ2cwCP2Hi5AOGttCv45HyxdU5\n1rqmcafrhmUAifrDHH1aSsDJcH+BSfBpJqJR7ux/HvHFGqd230RIUOAuKWWb\n9smiVSGxj1vUOSVyjNo/BJhAEWdgHBeew90i0zPaoKipqVuZJZCD72i939Qv\ndi0aziwfOwTlhk7e/EHUCVqZeMlmVAejqbPuyB9wLn0nc+3gAhl47i++R6yw\n4J15\r\n=lS8j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXT3TqH+FVi2/UBATSPn8+oh7hJEw6Ibb8e1hl63VAmQIgG+UQOWvFHKlu7auFgpyKe6KAM5aXZorSpB4a8HL12fo="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1-709831f6.0_1644163407393_0.38874772670668967"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.1":{"name":"ipfs-message-port-client","version":"0.11.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.1","ipfs-message-port-protocol":"^0.11.1","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.1","ipfs-core":"^0.14.1","ipfs-message-port-server":"^0.11.1","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"_id":"ipfs-message-port-client@0.11.1","_nodeVersion":"16.13.2","_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (linux)","dist":{"integrity":"sha512-dT/XYWUGCvLmlHWtgTvL8TtobmWJphk5Cq499nG7Ng52hQUzZEUy0Mun1N3hqyd7SHMDVe7LGrQEY/l//seGyQ==","shasum":"75ef86ddbbc0de7ddb5e4fa524f947feec02c4f0","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.1.tgz","fileCount":50,"unpackedSize":152530,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJiAU4VCRA9TVsSAnZWagAAhE8P/RWaRMTsEUz6FKdIpMHP\n1/JJIAiNtSEroBigHUe8V5MvYkdOVu1gt341VN13pjmuQ0eo1k/SdZ6fVDcB\nOVkKOt7lA1y8SrDpbx/aloAcleazZFzYOqf7+5QKnfNlswLHDkV6APWTiwuX\nI8Tt4/l3AcE+GgvRgjZ4Np/U9e7yUlP3VqhHh8KlLDAnffBWdDWSR/pviojI\nR24HKDLNNunba+sMYcGkbzk54FnTGRTIKDknFrYLRNkeW2XES2FxLQnUFWPW\nkljMz27By3O+ez/dLy2JupPJVOdc41ApTuskStMURat0H9ylw3gLOJjYyKDA\n4Ua2DHi4RzQ1Q4khTYoJSzpPdYJVWrlrCiVnB9GykeCIcAlet3J5xObcPwsZ\nKI2WJBLE7MgDGCm68aVrOZo8gcrGNScmzA1emGYrOsUPfbKZHdIgJoYEOP3Y\nACww9b3JrDlqBTUXj+OJO4VrGmUmHrVGgetfnrjZUSRJX9O6KtoPjFjuI7vS\njcX7KJR2OI4BHAD/1K6+fibOhXZJdcgQVfTbB1yqFeJFToyxvz1zIry/FxxP\nPpmLEYe0frtPlF/ZAqfekKwVYq4P5WCz8rEesYMNOiUIjIlyl36W32f/IdKu\nRKaZnfpHyG4pe3B8Icls1QuBWoypl0hG/rF6A/4Xom1fXBrw4JxiflLZ0GpF\nk+Am\r\n=JP8Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICNQ0QusK52mgF+BRrdreLvV56z7YdoJfX5QNrs656PpAiBL00z3+RFt/12IfecYzS8XgROWa5mmeod6uhYiOsS1aw=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.1_1644252693478_0.9418499097114161"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.2-1082fce9.0":{"name":"ipfs-message-port-client","version":"0.11.2-1082fce9.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.2-1082fce9.0","ipfs-message-port-protocol":"^0.11.2-1082fce9.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.2-1082fce9.0","ipfs-core":"^0.14.2-1082fce9.0","ipfs-message-port-server":"^0.11.2-1082fce9.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.2-1082fce9.0","_nodeVersion":"16.14.0","_npmVersion":"lerna/4.0.0/node@v16.14.0+x64 (linux)","dist":{"integrity":"sha512-lg0n/AUKX6D6t6Ibe9I6+Y0bXWU07y6tQBw6vL+bH/5bJN8bG0ELxe+kzs+5PbQplz3ajvvFtTYFEDGf/k32Ow==","shasum":"8ec613d41be19f2e3213c6bf2459962e26535b2a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.2-1082fce9.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiD8YFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIFRAApL+RS5CFijdB/3LszlZ07OOIRnYn3llNwNVIvdRjZy2i6hns\r\nTnAa461q52w2g56dXUgPrAKsN8Vtfvv5jVIRHXF0xC1v6wzjm3BunKk8849s\r\nN5DInfvGf8M6eNIQ2kdmNviSrv1Dz/ip2A9rib3tox/oI4GVEDSUVwiXG2lu\r\nGCM1S948/CEPboJwb/O84MToLC55EPBmbbf4ZF4yea2ByzqhA71NkFMUhcaV\r\npCBrN/5PuhEOe15qdTgoDdM3ovDAuJqSa3cFHiB3p3DPya5j9Z+QluaB6n7Z\r\n12iQykyJUjSTtQVo2Z+Nk85aYCdkcerlExtO9O0aHc6XZLkO2ZE1fmDJ3Cm4\r\n8H41OQ+OONeAaYkfE97gfu/6xPaOdqov424PMTsztN43n6rw2U1iBZl8WlDx\r\nqaK06nOJ/PSNdTLsqIImDl/NbRi5TcDopr2cMtsG7/JlSMmBAw00ex8nL1KG\r\nRO8YufcMiUAaaO8BI7ilGdIuNljIoa08OJVrsAgyZBtvQkpvYUiZ96lTO0yR\r\nnw/ytHjzQwF+CUdqVvj/9a/qMk4IEeqRU5rOCOxAWNaLqWd6y9t3aXIIlzdx\r\nCj9tq1/VDxkrqvz1eY+1G4Li1HjqXIbdzqxs1Tvs1DuxCjrrfZotUQLtMDFm\r\nlAkbpjnJHlqXj8Q4Bh38tjvj3Q7uu5fQJsg=\r\n=Fq+V\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDwP7r8fcs53e5I83rrz5D/9VhWybYvA/KixjKivAuajAiA4FnyO1sdFykqC/lf+LBRlQcr9ISzCX8TIeWzRsA7FVg=="}]},"_npmUser":{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.2-1082fce9.0_1645200900938_0.9499803415242909"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.2-125d42ba.0":{"name":"ipfs-message-port-client","version":"0.11.2-125d42ba.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.2-125d42ba.0","ipfs-message-port-protocol":"^0.11.2-125d42ba.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.2-125d42ba.0","ipfs-core":"^0.14.2-125d42ba.0","ipfs-message-port-server":"^0.11.2-125d42ba.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.2-125d42ba.0","_nodeVersion":"16.14.0","_npmVersion":"lerna/4.0.0/node@v16.14.0+x64 (linux)","dist":{"integrity":"sha512-cJntyZFsoJuxxU9tUAtRetOJBALruWT2vUoHaOurZjHkqmu7gg0SB8eWouYWsZIoQTHPv3szbXAoOvv7/yP4Ww==","shasum":"3d43e300fd05f73a298b066ac4f7ab07ddfb7e63","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.2-125d42ba.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHeuSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrb3w/9E/gIAxzDU933DGWJRYCVQfrK9JDONQaJu9JelNBiyQBtF0XV\r\niR3T85Zp+y3xeJzXXBZc/bZhAyPpJde/+yQoK2q5uTIH+g073LaHn+n87E2o\r\n83L1bpuyTFdjISuNDLrqd3EYphrOpOLJ/VjnuIhZztBLnA96rb7FEEsuXH/K\r\nhCq5NhoNiVMe6cs9X/4Ber4F7gxQ2np6wq6ATDcxLNnNYUXvnusw0mm1Iuo4\r\nHKeHCBdv3Dxw7x513/bnuH1FOUOCgsVZPhSwuYyBVczPK1X2Hp2l21w35TV3\r\nYcbQJTT+X4NkjA7AL4XtlVYE1y7NoVnPoXeGE+Gb+EBU+HZcQ8JkoaHKb3YX\r\n+yvhNYqhFvFq1zny0hMZa4YDxFVJZ4+QWA7lXcujESJhOU43F+DS1W6TWB9F\r\nZduwaEV+XSqpDSQ3CEfMlZZ2rx3oRZXzmE8GzdpwsYyoK9CgOuO3Uf/xHI2J\r\nbDpAOGfTSIZPO/WUJrEpK/XBLYsDBv0X68GSYHbvEIVm3E6WeEaDE/3kudCp\r\nuy1hDyPFMhQFKmTYJBm4O/LaaXad5Ut9QnybIymgqufEA0BrVbxhHX4t2U+P\r\no/LnWCRPOXEu2DFmWiIYFgko+u4OK/hoId+kog6eb71eznGovqlxba520GaO\r\nPpk4lBWGNJ3jKoZ22azB7xEZdtIpQHGio98=\r\n=TPKd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC48KV5/UrZ3lVtKwWpELKOCvWSiIsjw0BnLnijwWp/3wIgOrd263jl98fGkULuSZENodvZJDwpRW7dkm1r9XorzMs="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.2-125d42ba.0_1646128017962_0.7045197170081499"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.2-df1bd1bb.0":{"name":"ipfs-message-port-client","version":"0.11.2-df1bd1bb.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.2-df1bd1bb.0","ipfs-message-port-protocol":"^0.11.2-df1bd1bb.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.2-df1bd1bb.0","ipfs-core":"^0.14.2-df1bd1bb.0","ipfs-message-port-server":"^0.11.2-df1bd1bb.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.2-df1bd1bb.0","_nodeVersion":"16.14.0","_npmVersion":"lerna/4.0.0/node@v16.14.0+x64 (linux)","dist":{"integrity":"sha512-1hZ5bFc74fy++6HVJ/7kh5uVtx06cN2vccueKJR46mBCgZeRGZlzH771kVOkvgRnBr64/o9+BkldI0OZZojbGQ==","shasum":"862013e664c6504615c2eaa195e069d778882759","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.2-df1bd1bb.0.tgz","fileCount":49,"unpackedSize":151751,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHf9RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo9uw/+O12x94Iu3maKALBEN39BePcks3Koz2XX0No4dlBLdazLuASp\r\nGThzCwUB5bWXZyFUACtK6DD4L5ZEhNz6aibbP+8l2dpr9TPvgEsFOfspRt83\r\nOS9OI/iNuLIWuSj/G0TqVxtUlHe54ydOH1P5hLApSYSTUnIbbYhi5zGfazNZ\r\nbltSFCBqcTAyjmCL1M3p1PGiHIpYKBQAPrGq8q0ULDHHLjUgxiQFFVdP0VhV\r\nBkQl1yLJYnfCxGNnuSftY5Ee5Vgo4uMaiiddJIW5DFEugmaQhe1BSNI67x8Y\r\nIOybhvgsqXPoU6XzOwVpsZ7kY2NeV/hKleSXoEgSe6CYk/Jef3tLm8IcW6J1\r\n5D4Ex7HxWQOrrykWiuNXI5DjdG9fdNjudcMKm+gj36Jao80SR2mLbRALrVs6\r\nT0AvepVTOyhiVWZaBR4KI9kDnLVO6G82NZxDH/9mP4kAfK5HKdNEIkVi4CDo\r\nKW7u3zPsNu7t6BkritPXhtALDrerrPe5ndHrtzVZGYNOI4ZIlDo2PJbeUa5X\r\nvy5ichjGwcbqpuyHpxMkMkEt2jpxNyyV0l7sSJzOun3o7oAeIFPtYgQe3sFT\r\nsprt9HveMB0d9J0GPBRIiCavXBok6C8Vodi0DhL5wGrjxUBdAGgBZVhpfRqy\r\nenql7mf50JCWLg1SYrtiXxZaozyqlkQDYRg=\r\n=wA9z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBNjioMxY/FVZcKtmXdgJ2TjpLy5A6NybUAGaFPJitlHAiBleA6i7FRzWFG4zynKomhDGMqXeZikFVKiIORoYauNxQ=="}]},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.2-df1bd1bb.0_1646133073191_0.533744234223311"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.2":{"name":"ipfs-message-port-client","version":"0.11.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.2","ipfs-message-port-protocol":"^0.11.2","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.2","ipfs-core":"^0.14.2","ipfs-message-port-server":"^0.11.2","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"_id":"ipfs-message-port-client@0.11.2","_nodeVersion":"16.14.2","_npmVersion":"lerna/4.0.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-P0rzWLuvdPEzpITOTex7KYfp1HGiRvoadP9MrXOSVx1Go3LhGyT7XfVe8OHuKj52epMUSZaYz56pH/JExcVnTQ==","shasum":"e0053a25d5017050b41b0a13b76d23a7a11f6159","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.2.tgz","fileCount":49,"unpackedSize":151685,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFWgons3urhGvMQvp4QjWGiJc26jPmFzGZm1B5YMqVDIAiEAh38jHVkR0pcwm2wdVUxY89CzAh2/5AfMS6m50O3pY88="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTFvbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoZ3w/+JmuVjiBAWdASAKDEZ6Glmqe/zioxQAvEIA6DSyIcU3U9yNHB\r\nyj6ZU+bGGWehhmaJkG+TqunX0s/xWRWeeOAQjDmlqT8SUsHD7gUD5y+tOXrC\r\ns72uo78uqu1tYUUhQ18g+MxRYjl7le89khmLf6vpcHe3wIsiEgCZPrK0VK2l\r\nNup7e1t+KTdJAtkcbiCxInIEa1D0HGw0x3UwCWfsiZm3kSr2Abctx+i4xrcI\r\nSVqBeivrgovLMqqmpG0J4bQ50x0TMN1O7bkrgbn80aeRsVsUuOCb8bmdHjIS\r\nXMvPyQas82MwRVEoLI04C4/VsCTXYAT40CwKbvf/TluWd64Qs/fGmf9ri3xy\r\nkhHbMnzUh3V5tYwFQW3MxurxZJgqCOKCVp1wcT4Jfx3nDiRbUdN9MfFvQVnq\r\nW7Tyw60iJ41IcYodZn/itFilSvL2JPlj7vSWKg4w7hWwVZ/jAJMZuv6DoWJA\r\nfzXOQdvmasN7fx/JEX1bljx/mUm689MytTKqDhSgSOFWMcaRqmDyEG5VHPWZ\r\nMAK/SKf0mGET2dvJ53PbHLlY3gKFbvxDKPw9Zv6qgzjSniChjVJRvOrsRFOl\r\nll//8PPn3apjkqp6zX8XGDnQCsSNegiq8zB80Z3dsa/uKuPUP2a4ZSto1ZHV\r\nPkte4DNhyFXAwtgdcz42bJWUKESXlyOGEi0=\r\n=WSGE\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.2_1649171418861_0.5073055907394755"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.3-e90b8f13.0":{"name":"ipfs-message-port-client","version":"0.11.3-e90b8f13.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.3-e90b8f13.0","ipfs-message-port-protocol":"^0.11.3-e90b8f13.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.3-e90b8f13.0","ipfs-core":"^0.14.3-e90b8f13.0","ipfs-message-port-server":"^0.11.3-e90b8f13.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.3-e90b8f13.0","_nodeVersion":"16.14.2","_npmVersion":"lerna/4.0.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-kMiJeLVNCmJWl2esyDlBuwwr7/sFsA7hyKmt2rHd+T2LUHGtwuGGbjWnyFEw/9uu+NIFTSkHKO8icZg8NaBlcA==","shasum":"986a6a5ebcd611e0964aa48f2a3fac81ff9afe76","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.3-e90b8f13.0.tgz","fileCount":49,"unpackedSize":151751,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICjtIheN5xMBSJ3UF/NQjIWhCDR+kCOOAJ1aynodzx5uAiEA0OKXlHqyPFWwVmXPPy4MzLpDtbxGgWy9HvoMB5zLcVY="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTGngACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrkNQ//Y5jOZmgYF6jTgP60cPyDuIyV6RcOID4+nt1otqjAbneZlXii\r\nJ8B/UgynU3RM25l72QwUWSga90CUiGCWqrmIJz2Is5YFqMQxOjlsGC8ImLxE\r\n2CM5q5RcD5j2j6ycBc49S1jsbSYsOP82Quu6Ijpl1eSlX1w7AvyV8M1Mcdhj\r\nLUCPq70u+xsW6RWaKdDw35jK/zm3eLDNmvIaIoFUuhwMhwE6Dj/JHNjqvAJr\r\nApc7Vaz3eau1FSW380/bfORHR0cgpbA6oLt9gA+AE49B9L5KKMzxtMfVKTuE\r\nbf2wSBqSL0AvZCJ35EH6GwOXozmTjWIYsrZM3evtb8IQDEDQuL4VinkQ+d5K\r\nC0JT9JES3vdqJCmtR0H/oRD0WFRip7Ei6lIMeI9KySVL+alvluiN17KZolhu\r\nfkT9K+YdlQ/gPrTwr2gEw3qM4sV4uW80wssSvulRpK76S7FUZ5/sSufK4jhu\r\nTeKR7Rgdt0Yn0qHkyoHXeo3sNlhF0ZuzS3qTQ8F1lHxJsKA2AqOl2TvaOti/\r\nzi+aKsNRhFlNbCPkIcoUNHMpmUZ/5LDd+JKhF01DiMzpylkzkj1MrLOSGQq8\r\nB7etysP/7URoRFYW+E/C0vPkMxPNh8YQyZFP2ggMoBLkN0XFwjz+NQk8mODl\r\nrLLNQX+/ci+kp2OTQYIlpbqPtlmO5sddfxI=\r\n=FpS8\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.3-e90b8f13.0_1649175008601_0.6427007469639585"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.3-8f7ce23c.0":{"name":"ipfs-message-port-client","version":"0.11.3-8f7ce23c.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.3-8f7ce23c.0","ipfs-message-port-protocol":"^0.11.3-8f7ce23c.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.3-8f7ce23c.0","ipfs-core":"^0.14.3-8f7ce23c.0","ipfs-message-port-server":"^0.11.3-8f7ce23c.0","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.3-8f7ce23c.0","_nodeVersion":"16.14.2","_npmVersion":"lerna/4.0.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-WXxm8MmJiIYly4kL33rDeKAFRd8LDUrxYVLQk6GrKLKLcpLVlkOAxI62tYhuGjGqbAV8+OfYlUZcLy9FeE1Tvw==","shasum":"bcaa041ad23331c02d98b593855d773186810bff","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.3-8f7ce23c.0.tgz","fileCount":49,"unpackedSize":151751,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIByLfyqR+9quW5KLJXo3ZpCC/TmZ/JLgGK8L2yrnPahNAiEA2+sbQB8F2y3ta209aeL0KtyMG7M+7OVvUWXFFaDMQdo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiX/8vACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmok8A//ZM/q1YP27dDzl9LFd7/NhheXjq6mVWDOe2HdTaL6EcYHWDQ5\r\ngFkME3GiHkAC4sGGGAmcoKEbubgrT7NHW7AftwZTTFgM7TrdrX/BiU9ebXOj\r\nD5DmkDtW4abgvMUTBTB6ZUOy25ufzfAQzPGcNni1WBiphb5MW5qqd9f+ZLgD\r\nmq4xar67ZuRZS+/ogQpWDjxwQ6XemMJw+iwMSwU4UZHsyeKUjO+L4KsnRGNe\r\nKqEijOEcrTFQNWa16XHKdOXTCjAXCfk721Pam4N0iXaaJKu/sCBPdZnyFKQr\r\nLDZl7gd46n1ANLoPfipkCWgl5ahLn3NcrFoHD/VHv/jSQV1aqspd00JoWPE1\r\n1C4p8uQSRdd0OnMcViTD/HqHv2oHiwe5QBVr25uklS/iOJbjWxZTSG0L9ozN\r\ndZ+FaQPtz8BY9zKi8msSz+lYRWEFWk6nM1skpMnpisDFyzilfDBWHXO564lF\r\nGXfdVH6IGWzfEcWjly0HyuP48plWbQT5xMEKE+yjQ3bUEUdycDCcYCvQh21r\r\n8uXSiIbuzp529Q1D4TYulal2pAyPsZ9Uuvgzn6SFbdV6/VWsJucCnFO3Ux7s\r\nQ40za5QdHDAZg7Xd49iIA4w/yxIA+NJrkRv4fNZaXB/8umL7UXmSvE+fEf8C\r\nHAxE60wl2KZjdUpDHokxOeLDsc5hqsmPt7o=\r\n=teLg\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.3-8f7ce23c.0_1650458414895_0.4176473889716925"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.3":{"name":"ipfs-message-port-client","version":"0.11.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","main":"./cjs/src/index.js","types":"types/src/index.d.ts","exports":{".":{"browser":"./esm/src/index.js","require":"./cjs/src/index.js","import":"./esm/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"publishConfig":{"directory":"dist"},"browser":{".":"./cjs/src/index.js"},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir ts -p check && aegir lint","clean":"rimraf ./dist","dep-check":"aegir dep-check -i ipfs-core -i rimraf -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.3","ipfs-message-port-protocol":"^0.11.3","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^36.0.1","interface-ipfs-core":"^0.154.3","ipfs-core":"^0.14.3","ipfs-message-port-server":"^0.11.3","rimraf":"^3.0.2"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"_id":"ipfs-message-port-client@0.11.3","_nodeVersion":"16.14.2","_npmVersion":"lerna/4.0.0/node@v16.14.2+x64 (linux)","dist":{"integrity":"sha512-eMXyW6SVpDJN43R/XmaYbOGFvjH8yPuTafZ4FwZcuSpzOuj3JIRzQIVST3HMqYGse6zyo/6qbgmUixa2yzE2ag==","shasum":"1bfb91660f567def4ad05ba335c436dbd13797bb","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.3.tgz","fileCount":49,"unpackedSize":151685,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC/2VM5cAeNoZrcE5JTQO7g95bn3NaW3DSOLSg/870+6AiEAvqeDvKruYfE1M6TbB++jJ5C3+Jdd+qSjOBe/HDtG1gQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiZ5jxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmptJQ/+OdycndCDNhzs1Hrr3KiIvE3kmHGnWx8qOOgSbYWOsh2e1Kma\r\n1voFEPZZYpTodAKYKZdHP/np7Fhl6OfvWt6dg8ebT5KU47TrU6eeJbDqs8ps\r\nl4aNS4z2FERfT8DaG2RBYFwFIxT/pTfHI+M2xPuwxvStn24b5Z9mPYPxXSSi\r\nVKp1ZmeuuXX2vJ3ynTQHVUg3nqr2N1dCEEYh6XoEWCH2OEVQUK1ByCrSjkFa\r\noFyT5xPSoS/yB5tnBXgFggZMBUJZG/5qMEVjrOl0fBdnFLn51HOgkRbbcTGz\r\nxEj4EnZLwrDqRP/Agg0Y7kFJeb0rwBMP3scaHce5cDFEHL+PRyCxo04beznC\r\ndC3DmIlRuZcrePKI1Jj9LYVPe4VPyWyHaJXh5bcSDzbBXN4/FiZtxE0mX7GU\r\nUAn8vwMJSw+jW5a65lNpPmo35YO6A4vli7ADknXFrPkt6VgpggX2eqQ8lnv8\r\nrrG43bwrIbMH1ncTNrFA1D/CpQHIcBzj+3PyB/1gVNwgeuU/XhPfJEVvD63A\r\n1wwFWNuiv7ANTEoosDDxLVrDhn3KNJX3ax97jQLFQs2Zpdz0EH6W6tHAeQDI\r\n7sobsWOdlBkZen/eS+1YHFJdUE1jCM88vUv8gR93n2KvtIjcq2H0/RSiFfWd\r\nqe8cQEMIewx/rzigHryJItIi2jLtKN/XEGw=\r\n=H4fs\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.3_1650956529464_0.7315064267702165"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.4-7165bf71.0":{"name":"ipfs-message-port-client","version":"0.11.4-7165bf71.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.4-7165bf71.0","ipfs-message-port-protocol":"^0.11.4-7165bf71.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.154.4-7165bf71.0","ipfs-core":"^0.14.4-7165bf71.0","ipfs-message-port-server":"^0.11.4-7165bf71.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"0ef2fedb9b9cbed1b4855c48b5f03d343ceb573b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.4-7165bf71.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-fTENO3D+GIzVkwBnR0F2Qhcc5JII161lfRv28M4YqU8LxOIMbgDQldi628rmlRMqkPv5LfxyjS/Q8NWfhEhiWQ==","shasum":"3dce7694520efdbe4da04ac4a85bc476854f0f42","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.4-7165bf71.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbJbSJZoK4+fMeb+7Lou/8ZNiZWYEgjmc4oC296MBBNQIgMyKdJV+vgrIghYPICVCG8XNJR9ZRpz0zHW4Dmae3YQA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJigq8bACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmresw//U19tgc3HQQ8Mz0aXT9TQHWWaw4dTLQ5nRx2m/aj1i1iQpqsR\r\nx0mhNGnvMTqmvX7Jg8ARCkTB7ChVvTNTRjkmMqkmdy8HlUk244TSWJ1ekeIM\r\n3MwplDN0APZoTiq58OPD43dVdx0Hv6k6ukh6My3vw5oFiQWfjNgE6FDLqqqw\r\nVskfkGGaziE8wzWjHUTxbV+hSAPFzrWGgxiH4ZlLBzA3+VpZP1D/zCR366Xw\r\ndIoF5A9ECoeS5c6N6M37zZyAgmLrSi0uhm1jrzrkL++FPBRQDSDraY7GKqy0\r\nNCwJZVfuLX2BHmLqG8+JjWIIlLoBFI9saa1wm0bwYXCYcOn8MUcweAd7HSnw\r\nOK+fgNzJvK4WpCb5JVwy7WxpXToqh8+fy+7XTIHkn0ZKxtQh+OPNmoTgJZ7s\r\nKAlVgG12q6mtlk8jV7N7GM2BlGktin6drvraSeEFAPpib5EgMQERW98yrzg7\r\nGUgy+wAjyxnI19phDNdsPI3It162ydy6A8SGofDf5zJJt19wwXpqUA6HG87Q\r\nAXVYv7j/KuHCGFpGme2e+/j63NwxRe5VWWvS0K8WjA2+H1VO1ht/vCGYIQu/\r\n+d/YX5dMA7IeiYmhcanLHCEq1N/4nDFZLGBuGDpYuYCBA2KIYrX1NrCEHHra\r\np0PSIPrr9N2ov10PV4zkBdqx/7WFMbdqgSs=\r\n=xQZM\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.4-7165bf71.0_1652731675748_0.9083270640450769"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.4-4e93dd5d.0":{"name":"ipfs-message-port-client","version":"0.11.4-4e93dd5d.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.4-4e93dd5d.0","ipfs-message-port-protocol":"^0.11.4-4e93dd5d.0","ipfs-unixfs":"^6.0.3","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.154.4-4e93dd5d.0","ipfs-core":"^0.14.4-4e93dd5d.0","ipfs-message-port-server":"^0.11.4-4e93dd5d.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"102f592858ec8237081913452cf185a3e44d2596","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.4-4e93dd5d.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-87RrkXA51i9gAIfi/8i7wcEBlRYbQiqVIzLj/lKw+MKveDJ5Tce7mdP5gauo6C/GF9cm8ixyAcbO6IbILN1AsQ==","shasum":"722ce4dbf483b593f2e401911064fd308da67b05","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.4-4e93dd5d.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCsvX9u1ih20W48Gvet/7ZtT8qlRLp7wKcFadc5G4QHsgIhAO4ldU6mA3hF0L+FmRjP4xT+47LiFAOmiYJe1+v7xwKd"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJikNVuACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq+Sw//fJ0Cjg2VaZdsVFOhR7S/p3ajQ49AqQ4LKtD8hU7ZW2YmgCjy\r\nh7B0Qb07+CpJZScTXFFojgh7XReWy8l8EDs9fuz7HbHWN+H0GWO8EjC8SRdY\r\nzkQtMeSD79pWyZ3cIzPjPYndgTslZpYvNd6vGgnl2gjSB++dYwgF3rdNlfjb\r\nWzKLvBMozf5CUo0qLFuDLu/1OIOS4Zo9J8yCmb1NsLpl/ROdYwDI9u0khhmB\r\n7ssLwEIxsh0yT815zgKksytUskmL9/FNG4uv0pi+JrsxR0uLLtOfxhg/xZRp\r\nUA/zPMv9pSVKCSHUpRiHz01CAo4qOB6/pZzYq/FexD6R6CPUBqH720dqo5HX\r\n9AT9XJW8PYRHkCrUV2cwfoecyg/pdWvTJwTIJzOq79DCXS2sBrcafOvf2fED\r\nwoMr1RJG9G+bHpvAth46VWSGQAZHfbmF0nL12Ug1F2ieUjHMnAfzZDXgRTnw\r\n2wq9PpTwvKuMmLfxVB/5Ckc5bz+3j4yjAlpv/jv1zcV654IhsWQsKIrtXuAk\r\nTbZ+CVCAbeU17g53PQKo9cQiCojZHb0Jw4BJw6f6SK44QVHadHpWG5meHe/6\r\nkn/wv2fWy8vJk9ZFRyYfqiuUDUg8B+03DrQ0ZInm2UZpoNqgEDVJhCnmAlSf\r\n2eRSmfFYZmix3iCyxII8PM6/+4yCSCjRTNA=\r\n=dLZa\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.4-4e93dd5d.0_1653658990687_0.11481334123479603"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.11.4-919b27a8.0":{"name":"ipfs-message-port-client","version":"0.11.4-919b27a8.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.10.4-919b27a8.0","ipfs-message-port-protocol":"^0.11.4-919b27a8.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.154.4-919b27a8.0","ipfs-core":"^0.14.4-919b27a8.0","ipfs-message-port-server":"^0.11.4-919b27a8.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"b3b172fe34f542a72746b3af9351bcaf25bedda7","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.11.4-919b27a8.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-2RR4qedssPuMPYFEV0mX9N+E6AlmTtxJ0NMML/Yow1J8+23YNZ5s5sMM48h7EUdd4z3Xn/TfX+1/cKvELRAG3A==","shasum":"3edb17993e8a249faff09ab977bd1353c0c4ed4c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.11.4-919b27a8.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHTw+fVFOp70BsNuWOKnPphzlpb3BzbcMYpcLBuZHJ9gIhAMTevJC+pA8ExiKlwawef7uGfUv1S8sz0HFMBDm/SlaK"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJikPndACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDsg/+P0FrQ8W7REH2r32WMg8JvAD9FeQX34hOxBTwPX3JA1Uo5YMd\r\nB3g1g3jZAk4VTFxZT2/TXoCnXXq2Z7+MwtpZTfdCg3vm8Ij1BNqrRY5zXDbO\r\nYLzqB4oihi0SBzBmLGm9d+snhQgL0iJhwOXwy6nVlxWw5jr6nPQINKvfnB88\r\n57+Tw+83HZxiQDTCJ55ek6ybOWoIpgeNo+JrthAWdglGp03QIXmXieL/w6O5\r\nWbMm631PcY82VtiTOsJB2NiILcOSR8GQQd/ZjAFCZ4tHlNr+MmjhhNaHXVDf\r\niDu2/rXHMAkS3ZiKgZin0a/jF0PmJaEe7+CYns9ygUgyxcbPxAs969k6/RUU\r\naHXFucyEzVMIq8zPMF97uJT5Oj5fnG1lyk7ArFz+OLoCh8nihL8Eet7/q8NS\r\ndOhIhsjspPnqQsAACQOQDj8TiZ6J32wBk4X/iWKGyBWieC9+vyNjdhrFZAGu\r\nUQgnpX8zCRnK2ff1k+0tBkiUY7sb69u7zW+kUcAPP1Q6O34v2s3Gs5Fk8vYG\r\nxsmRILsje2+KOZsw0xSguDMgjgAQqAiUu3Wla6LFr9ZKx8dxKvNNxqY3adUc\r\nTqF4pWXQQX6w6E00Wuh6JB8nWCUaDUBQxHqq0/l2SIIRavBZuoqZ6rzTliwy\r\nVOhowkuvjQO3/f4znvqssIrxgjtzS8F+Of0=\r\n=N6xb\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.11.4-919b27a8.0_1653668316696_0.17715742018093739"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.0":{"name":"ipfs-message-port-client","version":"0.12.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.0","ipfs-message-port-protocol":"^0.12.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.0","ipfs-core":"^0.15.0","ipfs-message-port-server":"^0.12.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"38e78cc875309ba6316706b63865e399dbcd18c0","_id":"ipfs-message-port-client@0.12.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-BsJwHV9JJExJwZtjC6yFm6J6zERaFzUGPdF9mShBQAkV+x4jTDLSgEtfSuskZtubvH+v+Q9K5j+lUvJM1R9IxA==","shasum":"20832e934b2b86f55b2b76a437708d36883bf9fd","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.0.tgz","fileCount":36,"unpackedSize":145983,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAe9NcGP7dteOM1rnNSTUpzBbvLRw2Y2UNEwSND0U88IAiEA76Gh4a/FiozV/e2XC1OGcHUpmR3bVs0LosswKyb1uYo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJilRhDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2WxAAnvEu/rVONydUu0MmM+L/dg4TrLWdTMewPZnirTUIOlFcFWw3\r\nV1vI2WXAk9VmcHtUr5OpMvxeUrsEAnFV543uSyHU0FGNphoH4NHROwV2eDQh\r\nuhZZHEGVNhTQJ5m40vaUtDtnqnVmHSoT3xYk+bMg10Y3f7l+O71a1uwF6iiB\r\nS+MNzsb+VHiqWtbJmrvOKT8Ulf7QoR9y4VMel9KQ0JNNuB4JIBi1ql88dnBZ\r\na3H4a0djDNbnyo4gVD5j096XmLzjDb8PKkAHsDeWal4js8N0iIJg1PJ6k0VU\r\nJfUJOlE8LoyaVxtEDxwNuiLpYFEhXq+LkJJqCHlS1hY4hkVdnRxkadcBFaT5\r\n+KisXjYhFqDpzlAr0jvhaka/qUCIHXTqq4rfkpDsP9ivUVb6pb1W8b27oI7x\r\nlb3aLCo1gDAHb8RyYG0IZBOuZ99ZfAjliFVnilMTPBtETgXeuakAxIjsSszk\r\nf90aM0W+duDvqte/pyiNcNc83l34cBqbAfqpaZUD1mjSer9ZsoAv0pqU0gZg\r\njT1R3SZ21d9HlAyo2UxuAmxyfl3MGmHItpLaBuGv2VO0vOobqh30wrxI4+8X\r\nDQ19z/Tgv7t0NL0QUT3bdNkagrZqMNv/gQIcYLgK9rIgsmNYDD78GuHtOXJ9\r\n1vdZ8zaahqfgbeFpaAYUol8JuWjni4vmjuo=\r\n=wtuc\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.0_1653938242780_0.4948384377444237"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.1-ddfb899f.0":{"name":"ipfs-message-port-client","version":"0.12.1-ddfb899f.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1-ddfb899f.0","ipfs-message-port-protocol":"^0.12.1-ddfb899f.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1-ddfb899f.0","ipfs-core":"^0.15.1-ddfb899f.0","ipfs-message-port-server":"^0.12.1-ddfb899f.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"87fbbf38470547cf82ced4c9fd2679df026170bd","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.1-ddfb899f.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-5+zTxxdayjNT5lsr0J2j8Jf/Af+g6l+CG8umMQYOOcz9KC4+2UWHmgXn+WXHHfqKzwfPEZpp0SUODgW4D0hPDg==","shasum":"0aad6d2acffe63f8fb173566a3be4a296394e70c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.1-ddfb899f.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFww+wROpIcYTphl/e78xSpCaigMoNPXTq0qxqC4j2HpAiEA+dFD0ENneQTFDkimp7TPuoWDop/jJOeD62rPdq69MQM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJilSGMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrYBQ/7BV85JYKvZqdR0in66O989iuzXtdzxRRWDkJ2JFdYlCF64qhV\r\nMnXPQQ0+k42KWeAiMBV3npRfL/atWXcjmWlqWLP0a8R2JjbKmp7i6MOS5CVG\r\nTENsa0w76dqK+spZwfVNxS4qAVDoTQGTFx12rfhNScDbHSPZHz4V3P93P/Hi\r\nYwMNmAAErA3J8r+iCsFu8jqN5k0fNtQqlJM43dJQCOGoObaSgN4BfFWEpy1Z\r\n/TX1O0xaYi4jGoRYGTP1iNm31HH3kSj+boI1txAwLR6fbf0gCkBsCc0+FzcK\r\n7k0cQ0ZrMQJ6KWXImnaO8zCvuSJjfIG7LU9V28Pm8uGCFaurMXy7jZGwjCZC\r\nmsaFuILocrM+t42THQvpZZJxusR4cjMwYkuenYA+6hIgmJyEmmc9g9f1T2iO\r\nIby7wMw0yrBqBLbf3iEysqMDkV7oKZ5nIHPSkoRZasIse9aZjqXAlHLzqPUV\r\nWBGkee42dnUvdk9QrhD8ZSgVhP8THIsD1iNFOUUmp9T1d/0SB3HmYNhv3xon\r\nBnbGVbPwmc+4hLYrj8YGL0lhEBgAg7bucbmw9X0+tpnrcBRq7aOZUsJPwRQv\r\n0p1JaJoVBhPp6zo2JcPm7IdvdaNLTEUJ6w59O6DLjn7Jzka6t+1DVdBjK42E\r\nIMDaBkNFvfBSHfPplYYoYx2+K5gZoaHyBL8=\r\n=Vv3a\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.1-ddfb899f.0_1653940620029_0.5236789183046209"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.1-764b4adc.0":{"name":"ipfs-message-port-client","version":"0.12.1-764b4adc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1-764b4adc.0","ipfs-message-port-protocol":"^0.12.1-764b4adc.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1-764b4adc.0","ipfs-core":"^0.15.1-764b4adc.0","ipfs-message-port-server":"^0.12.1-764b4adc.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"e174046b9ececfd2fb7fffcd8f6ad6211adc7499","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.1-764b4adc.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-zBWTW5hslSi2uY6BZ7XdIoFQVeU8JLFM76N8ijIJkCaz4NxX9WCtLjfinmktvGEviLt8/4e1Kbn22xd3njq/6Q==","shasum":"ed4ee93ba6792280d136e1dfa02d5ba64c93ffd7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.1-764b4adc.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcQWsmBe51cAm3RqGaOEYcGuk/wUe33i9IkLiUYbB8/gIhAMOFSty5iHzLrAauDa+5tcVkGfb76Z+nJDM9hFlSd0Qn"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJil3cRACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrh4A//a+tUTQ4ZrjRbLFJOgiO2ZLv3xwzm2RWz1z2EXkWtk+gGM5XD\r\ne9BVhXPP1n/b/9vJTsHuNr+jXFqhtKtkcGm8sj51n+PuGfuYteNdALU5yDje\r\nL3Ko5HIxn7h2yqaElpz+1JoqHeEJCcMwjKGX9OdSOzlq8u0ESMciYn+lfUyc\r\nVF9D9O7WXuRaHYSfHeBLqitwx4w214G3e+2VTszF9IkqKdzpVBJYbrLK48Z7\r\naQRpFTbTaRhFnSPKXVEGEWyeogpxMrTlmI69SsRk5IpBD1llaB1+rvOKFUrz\r\nsTfixJIBKcQZNiLeKt0LJTmIzSLNHpEhcQOHB7UkcvviEPg/DqsEEZXXg5N7\r\niDYaJV1wviz0WyAKgf3bSW706mfPIOdyyVW4P4ckgb8AEN7gZIpcu+EDocNY\r\nq20WJZULyEGiIw3SvTdoe6HszEOk9XJQs5+5s4ZP5chguHH5Raa+fbOWtKB8\r\nIOWvZTXAfxJ8T/ejlfN+gu34gQwyXUiPNvPgMkXgFz0uj5JzaNqqkr6+JweK\r\nva3XS6fw/55fQGxv/YsGTsWwtQE7c0PPLG5ulZsyOC/w5T4C9A19exvEv3EV\r\nrdIFdpa9+ilhAvL0ob8ByUbdf3YV29Vr53cAi7/fcOzCuvirA3lxSIjnuK8l\r\nr8Goar6Zn4gu+SZrYfMmfw9ZziVfmM3mNxI=\r\n=6Itp\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.1-764b4adc.0_1654093585169_0.5167935750511259"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.1-be025c89.0":{"name":"ipfs-message-port-client","version":"0.12.1-be025c89.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1-be025c89.0","ipfs-message-port-protocol":"^0.12.1-be025c89.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1-be025c89.0","ipfs-core":"^0.15.1-be025c89.0","ipfs-message-port-server":"^0.12.1-be025c89.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"624dbe983b6f235125107b73ccce5ca3e45cbe7d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.1-be025c89.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-wR5aUEOwYYdHsbi1Iu7vdTj6sUqljOmCsCCT9CBDB5w9DsgYlgL9O11Fp8lcfFo+XViDz7JiryHIXPYaErndgg==","shasum":"1a2feca1464bcf67806333ba3cb913aaeb6a2eba","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.1-be025c89.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDDF+T6Xj5SjA+txEXH55aSPhnDAhSJcjIeL/dbJ8CTNAiAg8a2wlhlfu/1JTdFdZbEmkmFsGrebnc3IS2VD/8xQ4Q=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJil3hGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpy/w//c3iZKOWARyVjgVfDHWLKxQ52GRyyMEujFenzHiGtSeOVAh+I\r\npPcJDvnbj/RfKFDyeHEDLFdYW3BGSlvmNcwAnu1unDCum/ADLbotnJIC78hO\r\nOr8SHEoXYMC4UNyCpQFEm7nkycI69a2aGfFrPXZhX/HnztJEFdGKQajqKOkG\r\nXDeZ5ioxOZdncYvu9r5+20qqgwcecVjsWV25A77/VnYEkeqg2EqL41RZgGh5\r\nsWneh2mgYyoT4yTPob2IkJ4kME/iOPvP22sqEQNbTXrBqFMamSyyP+qDfx/Z\r\nAnVElFMuwjVeTMRR0sSzLnjWq5v51s6TAmvPB6X75FeeKJgKs5eHZhB4do8L\r\nltMdjuZW+oatyWO340sUKYJFaxPZ8frU1l2ZnIdvrzhK04v9wWw/rl+04bFC\r\nOaR5VG4zheqoRR+9HH1uY7mJQ7NSgPRDn9umF8ujLeaWt6ImTISX6KyE+Mv2\r\nSVylch8LUVwsFOPS1IMwatkejVhaRbjn1rpai0bB1YaSNanrofge2aGTuZi1\r\nnRpVvUDalgyscUGftJcAMaFPV3z9tKXD6vGlYsB+qR4+eorzK/sx8eR3XOHI\r\nd+Iff1TtAkktgGmsC1z3+4P4O05+oppdiddeMop3XVyYDADNkwz8d6H/CHep\r\nn5mOUgSotqeaT75VGdGKwdUI8CgCyG0Qp2U=\r\n=YCh/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.1-be025c89.0_1654093894333_0.6987192559465236"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.1-87e00a69.0":{"name":"ipfs-message-port-client","version":"0.12.1-87e00a69.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1-87e00a69.0","ipfs-message-port-protocol":"^0.12.1-87e00a69.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1-87e00a69.0","ipfs-core":"^0.15.1-87e00a69.0","ipfs-message-port-server":"^0.12.1-87e00a69.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"4aa63330e4f3184df8f4d39cd0880c0ac903e795","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.1-87e00a69.0","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-kNBxtGs+bOP48BfrnfLEfzucCzMGY6+xhdIjupEpKYmUXxnVH7+v/6RhTWK7RwHVFFghkX2EVqVPRcOpVXt3bQ==","shasum":"3c69b9ff051a33809443e1d5b2a571d18fbff653","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.1-87e00a69.0.tgz","fileCount":36,"unpackedSize":146049,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF4hPDWE6zMbSoZZwwFuSmQE1iO7fM17LlB1FXnLtwyWAiA/3sxqpG8UBEIiyBlBgNX1794GGd440d0K0qmAyoHt0w=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJil3lfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEZRAAlKY8+qefdIsle5PpKMW03dgRn1fCyrhV8mEd7pdt2vhKOMB4\r\nSojh9LtO9C6HBLORHGpC3dqtlBHDH3rkAaT/YV2Cz65rteLyb4lAZHKndhwn\r\nT0Wc8LPedD4oswuEp5PhmrVbwN4uwkRy2tvlqcYQoBM4MXRvCtK6GCbdr/r/\r\ngbwzUfn2lf/b+dECHAi94wHLMg6Cx1jSwcD3/o/2X55oDjJz2c40jwg3Q0qp\r\niNJUJchCEdWrSA7FGFU+77+Vcp48Abq68lk61deOBoyhStMoZRlageDtTKDs\r\nGr4pLARd7N0DrOG7qVFLs3Qqj54T7UyVXZD4bJrcNVAM/BCksY/me8uJjwMa\r\nRns2TOUDNZhg99xXVnBVGndLdeDhK1tM4QFSZ+KJgdZEtPAszkut6cPU3CJ+\r\nXKK6oV0mZuWwwA9B6v+SPxAWF0EfOMx7IQZaC2XtyZYW/a/NBpJ0BiYfEQXE\r\nsIsw8eKDSc1eFs/6HE0iOrkvQ7N8/hpn2VB6+t+x3Q+mFPcpE+FfmeAPTl0w\r\nmL02z/B6pGfbdY2yB9nFeRcQbNNwrD7oPG/ulenM3wKNPkwWyeM9R4D8gRlS\r\nmc9WYKo2aTAWxNrqgQCvY/0XYZLoyZszL6oEzoaQBuAjrSmBNGk4KujJLQ21\r\nnaLtXV+Us5qxbtDITI+fiH6s9Y4BcANoDBo=\r\n=1tBy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.1-87e00a69.0_1654094175651_0.7233971122005356"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.1":{"name":"ipfs-message-port-client","version":"0.12.1","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.0","ipfs-message-port-protocol":"^0.12.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.0","ipfs-core":"^0.15.1","ipfs-message-port-server":"^0.12.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"548cfb215e8afa8dca64d3c38fa13feecbe577e2","_id":"ipfs-message-port-client@0.12.1","_nodeVersion":"16.15.0","_npmVersion":"lerna/4.0.0/node@v16.15.0+x64 (linux)","dist":{"integrity":"sha512-biHq7l3hVEfUrLnxP3LWtB0dpa/AT14hmoMfNTbc/oiwN4/uWZHs1seI/XNU5ebJdSlAo75aun+VuWrONTPDmA==","shasum":"74fd316709079a875eb72e7f44b471fb053b4f5f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.1.tgz","fileCount":36,"unpackedSize":145983,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICA1KKWchRVCPsfuslGV/uqlot7PLDrp6qP1SdiBK5okAiEArd6hHM0W+J8JCosSukEhVK0EI12MJQo46Xf5NNBVplE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJil4LMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoOkBAAhMaXLQqhWcNAzdFF9jPsY4HCk9lxTFY7EsfLKUj2sDUx2rG+\r\nM5mcHlCNx/wCV3OBoFIhDmWigVZn2Xc3Yzklt/jHlpBBlPotbZSrnLGTsgi6\r\nF1DXh/uOL3UzOOK2KriwL8KIutvExYZIUJuC3pStjoJEDhIz/anFVSzGqP2g\r\nXPniqCYmL8zpfUvXffvndR9RPUXpvKNrDgJzT6VPv575wiZs2ZdfoNeFnq5c\r\n4/MfbMsn7r/tOamX0f4elCKuoN7f6TJa/EMsfJ24/E1GvDYf1PfloPcx38Hh\r\nX3N9ruRiopYveGpFrIfiLw3YB2antbnvtTwcHFPAdE9F9J1z8NfmqPCoicCC\r\nDZN+dD0by/zVlUxCKfF+BLcw+8l6iQUt2JosMctV7sJtPQp7Zenj9BZZFxem\r\nqal6kzMSfwItQOHcmusrqoBimBammRZ6YFc48J/qGYpx0xBS+30S3GPaYHiL\r\ncWnuwAel6hPrIe3THD4sWhGgbdzLxsa0c9oqJTzW2zSfgTZ98ewQecFcb55I\r\n3uRG9zeaEEJMdSLzfPNBJDUrJEt+y9h2ReKHa/fIp2e306unfi8qJhHkr4JQ\r\nD0nF9+y1/SQWmHbd0Wo4pNznro6JR45AoEOXwevuN43s4K0cNYgN08dMN5r4\r\n667TAYta4VHmMOCu7Y20nlz6x3ygte7LKto=\r\n=+sC5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.1_1654096588662_0.4166852743487517"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.2-70e142ac.0":{"name":"ipfs-message-port-client","version":"0.12.2-70e142ac.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1-70e142ac.0","ipfs-message-port-protocol":"^0.12.1-70e142ac.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1-70e142ac.0","ipfs-core":"^0.15.2-70e142ac.0","ipfs-message-port-server":"^0.12.1-70e142ac.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"1a6e6bef85bf35b9328b61ce15d312f1961f5fef","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.2-70e142ac.0","_nodeVersion":"16.15.1","_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-eFK867E2hESyhh4vSeUsI9DbbQ4IVndlwK1Bshd8YV+ofg7mU7Zc4tKW/Szkg8q40eAEC34Ay9WIGdVSEhucCA==","shasum":"3bc28b697b7ff808220ade7ab611e35d7a39cbc5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.2-70e142ac.0.tgz","fileCount":36,"unpackedSize":146050,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDii6n73GZk1340jJqYh+P40uR/7+11k+79WcwNxhlPsgIhAJBDJVayWsH9CG07KgXPMUWPRtSn/Cmy/uT8FUy4sEBw"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJip18iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpKiQ//bDfKdx7SzSGHNIgEeOH/WWTKyIeZt6GO+ND3o/aWdI4vhuYP\r\nafhmctK/XL+ICAOtyfE6LyPlJwObEg0Qc6CbMbTOWtKBsMbEDwmc7otRVCa5\r\n2J0clRCXVvL/23cVaCdFhq6aYYwMMDQwTX/R0EWGQRYbMs2/z6BS1BAQbk73\r\nFP3QhXTyolprGT9G+7woXtknyoc/+gkzdttS6SLetegaf+wAMQ4p6eWLQ7a4\r\nydTsce1q9YY7Sv+IXrDs2zaeZ4ROSYcdyuZXAfAw+FDoSJJBd/MuKq8d6vI3\r\nOzzJQL81GPs4Z15IUZeej5zVDCFdKKQyZE2CXUnZzxH879hCu4aG4W7B7Sat\r\ncm3g1c6aPFTgxdXQQqcXhK6UnhROTpuFa8g8ECIGsnxrAv3CW1Qa4l33PJy7\r\nd7NX8PkMS2rilVatF3RcqU8jBqSIWFtaHw74YaG/eF1eXfe6IaJoapc1VPzg\r\ngO92zDQe3Xvmy3UWHoyjsYUml6IZhR8CCwAmQGo59nVrKF8aTyc4FBJgTOtb\r\n7INIIYMMKnot6gMn2ZQogYHhg5UOD0/l4nBaBLz7zaM7FCJS9qd+RXDZs4kM\r\n3uc617fs113KZWWrAE9fi1gkpJmczkxAcmN0V2FCVGvnHW3u1MAtZkPqM/4K\r\nn+PQmvJeeYQz1AptvFByTAY4eQia1rIJYCI=\r\n=ZvXq\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.2-70e142ac.0_1655136034379_0.10451439110010075"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.2":{"name":"ipfs-message-port-client","version":"0.12.2","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.0","ipfs-message-port-protocol":"^0.12.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.0","ipfs-core":"^0.15.2","ipfs-message-port-server":"^0.12.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"0078aad85f92d7bc8e3a22eb9ef8efd257b439b5","_id":"ipfs-message-port-client@0.12.2","_nodeVersion":"16.15.1","_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-CP/vPL7I3Eeis8gPku7+3OzXGdx8te3QQJ08taI0IGXyypvPMP9BQlx7VKr7SLz8rzWB/g7wZycLSms4zV6m4w==","shasum":"2274650800303ccac6a4afc22ad897910a59c2e2","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.2.tgz","fileCount":36,"unpackedSize":145984,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCV2VcPCiNgTjbngXRKIzlR55lv/6dnlV7yleZg49aMcQIgRDnJJcmveTytX/e2gFMN6m4XX6Ls5gP3E+3VfOv1fXo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiqCnWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6bg/+MfteaCEPtpwHLuA5QZxNrgRD/G2GhUTfYMvkWkoSJGjmvjHI\r\nDxBKBvoCx3nThPMJQfF4HvAGtGKyiO25fkSvEUKD74mqE/vT2sky7ehiQm11\r\nwcJlYZgXBnZjTsbttR0un+AU5t/QgSzvG1UCgx2TpTWUxRnN3JKgSiUN3dM9\r\n0NG4KT1Qxay0/OyV3UxYQO8Ikbt676Vxlovif4peg9Q8UbFKeWFEStMEgkc3\r\nUSPgwB0RI4/CQwPtCYAcVvuqqmvZiU+w7v81RUpFoJ/ZuJPmjRCneJolViQA\r\n7NeKpEZ7h4/axkKdbxlvp5nQ1YidUiSMwZ4+iHvXNf9zl2Ua5dfIXsEOw9ei\r\nHzJuPtYQlN6ykDvphveeGiQIjloiLS2E/x1lAnD+b5hOcoCqvFhy93ZrBpFC\r\nFwI2deRESKfZNp0tQ/VRyYdG0wr8MJiY8NBkl4JopBRO3ecQY0HPBJ0W7Drd\r\ni0qldJOPCYWp6K789NcFbx+8EK8cAJ5/W+522tJ8mmnnR3cx+ONGz5q7nGDr\r\nasikiEfz808MIuZnfQsIwjWHExVDxKtAiIkSPXM0RklAqjex7wlwV7XbL4hA\r\nvScdk+1yWRFhpLNiQUV8S0CjEVhxh7Hm7mOCCUMMVGrTZSgktSkuq8rDVoAL\r\n+OZ4lQxrmiuOQ7B8n48/qj0AVroLXnZ5tvM=\r\n=dMo2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.2_1655187925852_0.5575079541697339"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.3-7be50bd1.0":{"name":"ipfs-message-port-client","version":"0.12.3-7be50bd1.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1-7be50bd1.0","ipfs-message-port-protocol":"^0.12.1-7be50bd1.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1-7be50bd1.0","ipfs-core":"^0.15.3-7be50bd1.0","ipfs-message-port-server":"^0.12.1-7be50bd1.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"8d1e141b6d72e6dca9162859d36425eab90d8b12","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.3-7be50bd1.0","_nodeVersion":"16.15.1","_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-lEfhTGLrRaAqLwjo9x+ovQups9k0jXNwrwg282245nMpQ7BkeZ798I7x+i87FeiVK/UfEdpV8K91BTxloxYG2Q==","shasum":"77af42f03f8c434763910583fcd498e1178a9510","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.3-7be50bd1.0.tgz","fileCount":36,"unpackedSize":146063,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDpWgN10Zhia1GiVpahpqGiKczQA2NqAKKbCp9234FHDAiEAiGaXN87JK/oBU2vf0ip2OJpZM8CI8QPEeKmM5oL9uKI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJis1X1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq/uQ//RevdyurAL4PccaQ6nps0hB12C4UrclyeCdlvZ7/YuAv6fWuj\r\nD0Tu0baWKOdEVc6BqnR/aHD+nzJ8UyMn2ci/ZJU9LnVzp6l9WwByt8SwwakX\r\nUW0686/YRGRXLLmKS2UWUT3uZAd0yptjyL32Ip+87O8f1Rei3heMyBZvRSIm\r\nz7eE3AH4TPFOxg+RPTYoBN9Hl8nwiEdzUkSsDM70jhvMS78BgydFanYC+pa/\r\n5ZcTkKRAabOB+x8OWTIDImcIvthkBc8J9pe/odVscuKnIwhQweTqWhmF5ZPp\r\nQA6Zc9HUsj+2aT1PuapDras5aI8zrSCpf+7P46ezZREwcB9DSHG8XBKFsMkw\r\nUPh/g10RznsnTZpX/fC8d+SpwyHndLntadHhVaw4hM4LnDixt+vAs+4c6x+k\r\naVbU+5HmjQnT9B7/lqwSQYUdUAocc87iwrkdKpH22v7ykoLorpRRSHbl6Jte\r\n2xfW+Q16nr10depENt+xpdLf+0M4ABcEm3sRBXbUQRzs6mNe+zbZwetcchNA\r\nYxrV1Jp2WcDsuWI2iJZc8JMNh7SYBdzoT+Nipix0EM7ySg91a1wX8uvdsTcw\r\ndP3NdpCAYNXf6CY0VA0j1BMD6BqN/YLfEWrNqU58CZ+eLN/z22p621qcHFqe\r\nLHQHbUFzD64GngXqcNdHtESpSBMs5dIV+TU=\r\n=Azed\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.3-7be50bd1.0_1655920117216_0.5367695491117104"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.3":{"name":"ipfs-message-port-client","version":"0.12.3","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1","ipfs-message-port-protocol":"^0.12.1","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.1","ipfs-core":"^0.15.3","ipfs-message-port-server":"^0.12.1"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"c1cbc810679405d5a5c0fcca0c5c7aaf023b2d22","_id":"ipfs-message-port-client@0.12.3","_nodeVersion":"16.15.1","_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-6Le0cDAs1JJr4R1zTJms+XpiWa+8XY5ZEOE9uD0KGtDuA1gGvW43lZCmNUNf+gUzdTYpcMlPWTuTm+qpxP/7aA==","shasum":"1b4961997dfa8cf76b5cbd9092e9f64b123b69f5","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.3.tgz","fileCount":36,"unpackedSize":146131,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFBRvJWEAmsqxwtDZ/D/TUBt7YWoJm+FHT1ajA+0VTc8AiBLAywkcWZZ8b+Y1DHerlOREhg24diNkghszUgKp65BLA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitFaFACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpMFQ//UOByXdrjWfVm3r0sx1tZkUDLUhIelRvD+HZaXZff4V94wCgz\r\npOUXfKE9vmJlqzBy9Q+M9fmDrzgyyWxcYfncXC2Fz1YPez4HLqEIigcOPnPd\r\nR9W06Ps5X0iUsmalIkGfaD6Ctli5hX+id2S4zX+fxP/oN/0mjO0nyCLlCcjc\r\nAp0DxRg/RWZR/CvZH2U4Cf2sdul5cCHWh6tCC24KCU1+NkuePxRpksAiEdXw\r\nqaU03FR2tTAJfCumw2bIUCY2jygemrONQzFOdoAzRS7SsT7YKwixMcC0wVxZ\r\nusPN95Fs/A49MBhBfAtQ3Ht7HGRRtghmwp13Y6g4rVftdreHjOkGYflKazPq\r\neD1dCtKg55Qw8aMQfNtSHjjhc+Yv95fTyg0PbKqWU04/kRn3x+OvkdnE4ZkV\r\nX1q4q6qapJTvxnXH3L4TS/ZlXRCVWtN1Y3iSdTFLTKmirOLudPkiL6m5m4+P\r\nWNAOxVgAoD9aID1MhY6ugzf9vIL4AxfjNmLqI1GZR4T6KpZXLgzA5vVOBecV\r\ntjwVfFJTSCgHQqaNPMDNprOR3Wn0ZBzzkMCWJnh6GRtC5X9HsYAbJ5YeF0Js\r\nQvcpMmc6A4X/oBLI12xAY2wvcI39mtNT1pi9o3gkKdAB30otWAfcVCKmJUVA\r\nKoYre8KC4t5Mwqu3xn7Qk+3swPUMvrdTNVI=\r\n=NJdZ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.3_1655985797133_0.4354716186690113"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.4-00bd3dd0.0":{"name":"ipfs-message-port-client","version":"0.12.4-00bd3dd0.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.2-00bd3dd0.0","ipfs-message-port-protocol":"^0.12.2-00bd3dd0.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.2-00bd3dd0.0","ipfs-core":"^0.15.4-00bd3dd0.0","ipfs-message-port-server":"^0.12.2-00bd3dd0.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"5e5669eefa320838c4810adf62356b0039209ed2","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.4-00bd3dd0.0","_nodeVersion":"16.15.1","_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-AkGk2q83UQkHASXE8OD3y+kQILwkriQpewT432zqd1RiNWVpGg4AaiRTuTkhLJy8e6Bbuvmbt47gblYbnPq96w==","shasum":"e16645e4e2f94c06ab2aae83f7c476dff4a0b46c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.4-00bd3dd0.0.tgz","fileCount":36,"unpackedSize":146197,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVn0CPXQPmmsJBdcXaOai3sM0YRMnaVFL6ZIZLJxsUjQIhAM9vWiL4JzpoQn6ofo5TfUgR2T1m+xExK4mkSCM94vap"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitYRKACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmraiQ/+MwKE6LVWPkGIaRqoamyNGfPl+13ggBXEe4Hb4jXHEFv7s+Rh\r\nvHJ70wfD3e8mtlMTX3pbc+wPCZrCquZaGfnL8ku1QWsnIrtbztmDVP6S1kJz\r\nIS/eZl8t11WLTnwArWONChkzDt1vm5HKr2kCj0bWBnbW3OHi09J+UpGRlYbp\r\nNKFAY0MQxilA8YHvon8claMveW7mYVkp+5gQhkcyP5WHUmzGCNQdqLN0WOSO\r\nutzEd3Em8kshd2mzdyVrY31+o8mKDl27nMAyEv69iCJTN+L5fhpzRXD4ZvRW\r\nyKWUqRiIqzyDvWR0VoVnUlzQHupc70zXr0ZmOZCylJtzk9dITkIVD/DO5/Zk\r\nRv9KM40y/RA46SzejOo4+5aHGiiZzH3wkepdx7OekwQejDMuZiSpcCerkJZY\r\nOmmhk+DotyhbmKJ/Q+oBZIhmvqwwQB+JWrRxmYc29d2CXuM58nNR3z72ODc0\r\n/wpboyeOMDv+XWgkokENljYeMnWIjdZSrqORuNhtje/jREk1vdeFbu1rorU8\r\nnvs1vE2S8TB1m8jk/9QK7/NBkPZAyzeSZS/pAFRsErWYuTIEgSpaZIwHldrb\r\nmtwpV29cpr/6BsnimHxGkmyBRFsgL0M7qfx/sd0VxEblHdBaRLa49wXSIRlF\r\nZ57Wyy1ebBxzNw6JuO4YH0QFSLo4/s4uBD0=\r\n=vYto\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.4-00bd3dd0.0_1656063050047_0.9679121140869764"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.4":{"name":"ipfs-message-port-client","version":"0.12.4","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.1","ipfs-message-port-protocol":"^0.12.1","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.2","ipfs-core":"^0.15.4","ipfs-message-port-server":"^0.12.1"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"965f5a4e00254cee48fca2127d95209deaee09cf","_id":"ipfs-message-port-client@0.12.4","_nodeVersion":"16.15.1","_npmVersion":"lerna/4.0.0/node@v16.15.1+x64 (linux)","dist":{"integrity":"sha512-c2FBmikgg7MrakmRc6RnOKQ9FzPqNtRDI/tmTqcTbFSujCG9As6SKhJ37Q7OI3SpU4Nz8BsAW1y6tyxEfhCx2w==","shasum":"94a05261b5acacb55ffa0b2699438338032a278a","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.4.tgz","fileCount":36,"unpackedSize":146131,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJy3YfwzQzuCPZUvoOhM1yCtX2tm4ocX/JoKmX9as0cAIgJddJFhGPyYelaXVXTliqg+dPQ0kTx8sW+6S/awhwPzA="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitZEYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrMUA//bI81j+AKL/MCBvbJmtKQ5b+F8bqgaHda48YfXKJcJXKt26cg\r\neYpMtMyQzROG8atDGoJP6r2DqQJuIHLAlKRyLOSxq0BoJ55KWygM6o8hvCy+\r\nxdLgtJuycnwZJoHHWRiGNFsL4TkO3QKiEh8Fbf9nhgvGqgfgSH2fsYwjvHWN\r\nWhWP07PjOlLupV4K3PTlMfyko5w8c9LqBFYpPMyji81/tZGii1hSK4cdgpW6\r\nf85q2l4085ZWMy+HQGqjJXhpzaGfkA/Erlk+ca/iLJ9Vmc52sEW3QMsVy4GI\r\nRI6H+gJk/cXS+ubeLM+2KOLMZNFmTN+QUAhcGBLMmQiPhQb4vxhyJP/dhY6P\r\neOsVD3LSr892DyhlEGOLT6F9olXgh/lNqt9HbSdO8hCrW046/Gw1t3AoQkjo\r\nEwmboLH0uQXkxZFlfFKiBtgouBl3UVRgTSia2jR91PoKb6JkkyAxbG9WXgqE\r\n8MTBlRwj8wx0UYPjO1Li4hayftT2MMsOM91u2HRQ5QZPKnskkSPEhpMTK86F\r\nidC6d/n31do/0Wd3te+2Lhx6W9IMRGk/ixp6xbQ0+qQx6BasddxK7PfXyWuN\r\nr7bzEy7aJae/ceR7yusc2fIPEOd/clvJI/fDtgsQ7maML9o7I/lk4YAS+gSP\r\nHHSn/ZZoTxpllOj1gyLeNCQ77DNBIJYFsT0=\r\n=yDOq\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.4_1656066328709_0.09014294873155526"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.5-a05695fc.0":{"name":"ipfs-message-port-client","version":"0.12.5-a05695fc.0","description":"IPFS client library for accessing IPFS node over message port","keywords":["ipfs","message-port","worker"],"homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"(Apache-2.0 OR MIT)","type":"module","main":"src/index.js","types":"dist/src/index.d.ts","exports":{".":{"import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"browser":{},"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.2-a05695fc.0","ipfs-message-port-protocol":"^0.12.2-a05695fc.0","ipfs-unixfs":"^6.0.9","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.3-a05695fc.0","ipfs-core":"^0.15.5-a05695fc.0","ipfs-message-port-server":"^0.12.2-a05695fc.0"},"engines":{"node":">=15.0.0","npm":">=3.0.0"},"gitHead":"06da5952a6d61e890ae37d305b99a5f174a1555d","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)\n[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs)](https://travis-ci.com/ipfs/js-ipfs)\n[![Codecov branch](https://img.shields.io/codecov/c/github/ipfs/js-ipfs/master.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![Dependency Status](https://david-dm.org/ipfs/js-ipfs/status.svg?path=packages/ipfs-message-port-client)](https://david-dm.org/ipfs/js-ipfs?path=packages/ipfs-message-port-client)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n> A client library for the IPFS API over [message channel][]. This client library provides (subset) of [IPFS API](https://github.com/ipfs/js-ipfs/tree/master/docs/core-api) enabling applications to work with js-ipfs running in the different JS e.g. [SharedWorker][].\n\n## Table of Contentens <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\n```bash\n$ npm install --save ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n[message channel]:https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n[SharedWorker]:https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n[`MessagePort`]:https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n[structured cloning algorithm]:https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n[Transferable]:https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n[Blob]:https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n[File]:https://developer.mozilla.org/en-US/docs/Web/API/File\n\n\n## Contribute\n\nContributions welcome. Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nCheck out our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fipfs%2Fjs-ipfs?ref=badge_large)\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.5-a05695fc.0","_nodeVersion":"16.16.0","_npmVersion":"lerna/4.0.0/node@v16.16.0+x64 (linux)","dist":{"integrity":"sha512-3jqO5Om4mTotQzDwYS7VKjPLCbWQq/gKVO60DmrM/p7pbVNuAbrQYFGTku7zMwa1FqD4e/sB8OebWdrwA1SVTw==","shasum":"2f10a28200fed1b13b58a3c0629f903ad26751d6","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.5-a05695fc.0.tgz","fileCount":36,"unpackedSize":146197,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5LqBkIEGvLHNEUUJRUizmouwEcVhprhe6su50+o+S0AiAKG4FfTOhP4k1D7hGEJyGLYEm7J1OONe5cnUjrEcHG5A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi2AGMACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqvGQ//RI7lf/V9/NGjqC50VBSlwK4/8XN0rOiaWbhJ0MPw7EZFCZjO\r\nxwgkN8mCCj6tHQ2P+8nN2auQQG2Me9EwE9JHUpkw88RP2lVphiSAztsn7Z+f\r\nBj8ktBOfUWH8QYkD4CqxSruwiR7UsAf9rWdydHK5O9m7m+pDqoH7MpsPwVAh\r\nKTNX2+D6N9sHSNNnCPbqoQimo3VPqOaOxIX5O59U9hFBf2JtmD/eAcujJK1x\r\nvADtdQ4xJzcOmTsUHVa4zypQz/c3WhXntkGVBikC4bc6fG51YFS2p5KSsiwp\r\nlN4clCqIKOmIJ4EIJr6nPRrkeeXIS2Ek7wYOmlM/uYC80FxyBfyy4PrYmy7z\r\nzXsCy21eYQVNMGwHvoIGis3SYOZ9CgaUxZBdaIVO4djIt1maoqUowLQQDNss\r\naJcSmTzfzrt/TREgXLjkeZYBJGr5ELFKeyhKoJmMrLLqtPwUTs4OnfHWwsUR\r\nJGgI1K99vB6QozPOxKRFIMY1JnLxS6uJ3i1kXBwjaQn6cZQFi0VR8amdDyhn\r\nXwfqd/u4rr3afbQILJ7DvRuluvxBo6i/kknhrdP46Hof2sxZNwv6HnuEyoUD\r\nPUWIM8ERq8YNBe6Tr9aB3/xIt32ZrIXa5qqMAwIuqAJLQClrKXlpK5gmqCby\r\nkO/nWGPHaILTYg5QbAUO6dAPXeF0GRigijo=\r\n=MqVD\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.5-a05695fc.0_1658323340522_0.3482716428036352"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.5-39dbf708.0":{"name":"ipfs-message-port-client","version":"0.12.5-39dbf708.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.2-39dbf708.0","ipfs-message-port-protocol":"^0.12.2-39dbf708.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.3-39dbf708.0","ipfs-core":"^0.15.5-39dbf708.0","ipfs-message-port-server":"^0.12.2-39dbf708.0"},"gitHead":"a2f1f57d7993d04b2d19c3d7ecbeecc95a54d2ae","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.5-39dbf708.0","_nodeVersion":"16.16.0","_npmVersion":"lerna/5.4.3/node@v16.16.0+x64 (linux)","dist":{"integrity":"sha512-ANd2BloztX4EB7bulXgPvsbc5D2NZdPECVStalX91O6TTYo/6IBaYj1XBCIcuh8u0VSxPFjVrPzgXNKLaQ5r4w==","shasum":"d7d0b345181f48bc8cce6c6494276bb7e607eb1e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.5-39dbf708.0.tgz","fileCount":37,"unpackedSize":146637,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7ezeoTWD8HdzF1UsdwupkeYYIiEqIOyf5s7Qxt0564gIhANoJyw+tCjs0kltBCE/9I6kF5DXlJq07XdDuqhJx3nzW"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/WDpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpfKhAAnNJAP4WV9lkx72mlGZG4rRPIE1I67WbZhr71+wjAE0XaZ4NV\r\nLaPJtEQAj/t7D9DyXiMd8MPySPUP7SHVm7VziciZmXqzQPF9sFY8j2Nk1TWt\r\nn399S2+oYnx7NMzTnV+mgSRCieBF2UKgI5fzyaXS71BSt1Mi+PIIq9GFOJgM\r\n+FGN2hq4P9yDNs5ZcXaL65Gv5+Sv+8q8teRtczu2igzj6W/nz5NIgMID9EOp\r\nq7g6O50ALC3rvPzG25otDNPjX1I0NZaYsm+zCrBbFIn6nT5ikmM8O796R8QZ\r\nqmByANeQ9UasQubv+cJJBgTLU2O3BXgvbmI+frMQFIKVPflODEyhyxqau9lq\r\nfQg4r7aMC+sIKhbgfYFQiy4Qylr/+41Xksq0+cqpkHVSkeU8LyHm0yeLq4ok\r\nM7ShK7vxNfvTL7TCnS7tq8oHXX/rLp4Eyi9sn+TKeXJT2cppa2QpkweQsFzW\r\nZxPCuSFjMFQdTiuxlE/1LXrQ+9JLs4UpgmUxG3Z0HCs/5mh6a/xUIiKghbl3\r\n5etxJ1fJ934BviF8G+ntiq2RSuI+1Pa6cOUDV4ipuaIIHr+tbIc6Kw7N41Uk\r\nKLuysqAU1wS7ahXgYuUReRV+j+Cg/MMBPFETvOroC0vLRUXDHietOR6hEZl9\r\nONf8R9251SLLK2CedVmzJqb/9ank6VTU50w=\r\n=+iQr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.5-39dbf708.0_1660772585209_0.026501073656320928"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.5-8f351a89.0":{"name":"ipfs-message-port-client","version":"0.12.5-8f351a89.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.2-8f351a89.0","ipfs-message-port-protocol":"^0.12.2-8f351a89.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.3-8f351a89.0","ipfs-core":"^0.15.5-8f351a89.0","ipfs-message-port-server":"^0.12.2-8f351a89.0"},"gitHead":"59229f179fc680ee9075d2cc8deeceb7ff1b27d8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.5-8f351a89.0","_nodeVersion":"16.16.0","_npmVersion":"lerna/5.4.3/node@v16.16.0+x64 (linux)","dist":{"integrity":"sha512-+rQO3g75rpua8JJClnMedeazEN2BTJF8mO2qD/EwKrOUY2hmPM5eOrcBZ2W9D4vLrFW5emd2JFA7Sht8AN1zIA==","shasum":"5a37c383d57a226700f3109604d82b3095c635ea","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.5-8f351a89.0.tgz","fileCount":37,"unpackedSize":146637,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIArVsriA/9JIcsKgS65oBfOKibOrgtBmEBFStF5xizbLAiEA2JcZRlewoxAiyxqrIytu/ak9YjVVhww2HQrpCkL9JTg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/XdiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrqAQ//VUcqjwe8C24qZAMvW1MB0jO+qNnkM/wbwjCiZdpBDoyjgchy\r\ngrvpolPemYFR13PH6MjnVmxAxmeTRlRtDfUfqIl2zSoGAbgwbBo8gQL+g8RK\r\n9t2wFyS1JBp0Ruul5CrtDRc5L84VB8/crQOSCBtU3nkymTHYt4kxjZDQrCLv\r\nWgXO7ZcRJckp0iYJl78j9AgoRzC2uDvYsdiPGB2gzqOfM6y8DqEI/uef+l67\r\nizCvEhu1Ii1dnAREGrEQdYJuWhv5ZK4vMezwNL3QlFw2ownfkmgru1NI2Ail\r\n01BpbPaL3zsQMWTG0fxFeOQxrjwMxd+ADN4ePfungesbh1QxvwoaWck5LaLK\r\npjC6lmKrzfKAE/BzT3j2P3NKWsU4ANrIJ5AC7L+/SyKQIssq5TU2qAF687wu\r\nwOHARPO31bOQHMKPLpH7qqpXVKhY3QfK/3AoiNXynauQWpoXcHOUEcNFaLzj\r\nEmg5b7bwbE742FYCSqjyfkdcUtkn5lqTTiz288R5JHsGOpYsRG0rJpeyu7//\r\nq/V5DrDJ+9ZjkQMkyJemte3WeqytD9kYHwmXzDbZvIe4foKWZw1oRzHNUUYo\r\nYJtS/kU26OHUI1lDYKu3VJKg36uVOOY4R3p3IYlPN6rjaf5mCKnPEiDTizhb\r\nY9u9o4SzTaC4BCLgVFjOMqVAHRyjRDRWsRI=\r\n=8+9W\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.5-8f351a89.0_1660778337819_0.14797861091547637"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.5-83f9882e.0":{"name":"ipfs-message-port-client","version":"0.12.5-83f9882e.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.2-83f9882e.0","ipfs-message-port-protocol":"^0.12.2-83f9882e.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.3-83f9882e.0","ipfs-core":"^0.15.5-83f9882e.0","ipfs-message-port-server":"^0.12.2-83f9882e.0"},"gitHead":"368c95b50c87246f0c5b143b79deaa4329d0727a","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.5-83f9882e.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.0/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-YeFrlENrMGzMwkdMJriOS8NkbYF9KQaSNsYuY/n99CxbFCnMRFsp2mr4OK9j9WDPwDOdBvqXQX6iLX+6DIct6w==","shasum":"e7d1f55754a9663945ec6dda4edf1e15cd055abe","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.5-83f9882e.0.tgz","fileCount":37,"unpackedSize":146882,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEIQVnGLhUgYJiWPHn7esB2lP2/FWj5tn+RTQu4OI1x4AiAwx6Uv9O0e4eYtMOk3iim5XRmWJPPQA5+HhYFoGwdhkA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjFy9hACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmomdRAAllAyF7ZdhKpHmgVkYNZaOIfhnpXkJkQhAWRnOr1si5nf6P3k\r\nCgigns0quGJDHwm9qdqdUp9iKMWrM5QI0WH9Kf7UtQnX8sKD21WrKi6nzIy9\r\nh7Z1hXvo1qi/HcKwhtsBdq45hCFRrvGvUQVAq+KpqxOEnKXR9udtwDhL7qEU\r\nNSlRkOWcLap6uXvE2v8XHKh53d5Hk8PGMTrm8EaPQ9v8rjrnR6iBkBQYOjHy\r\n2a0XxwuOoH/rmDoi9tKspklGSZsYta2sSEnT8WdDyY0FYuu8bNlOqJUiYBRE\r\npnh00hgoLJHkzlo7K3TELsxw9v8m9SUTgpn6NysQXfXdoa3/JdCrFiu0Ggk7\r\nwAvAduISWnimCLeaL5CLpyUUtnHDTZfHRy5ksOaUB/B8FKFqtbixX/L/p64P\r\nVtqp1//A5ebOhln/4gEQkBetS2P0tm0H1FupH8GuOliJEj1Hcm2RlFEvDvNv\r\ncDO+gNX+T9KBbtHus1WMHnLeQuIg6JkErnVqoK6dK+ip/H87y/Ud3QiUuR5l\r\nql8XfnoeN2QZ1ewS/P2pDvukfs0umw9j536nRYCeTtFLkHQBe1Wy10QkQS/1\r\nUOzig7CytmU3/QGnck4/BwReMVkgR84jliUGi++nDxshyTg176WhmhL5IxIl\r\nee5lLjyGt/AaAZl59X8p3+tygoENNnkZEO4=\r\n=scMe\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.5-83f9882e.0_1662463841422_0.3335617044445134"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.12.5-051da161.0":{"name":"ipfs-message-port-client","version":"0.12.5-051da161.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.11.2-051da161.0","ipfs-message-port-protocol":"^0.12.2-051da161.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.155.3-051da161.0","ipfs-core":"^0.15.5-051da161.0","ipfs-message-port-server":"^0.12.2-051da161.0"},"gitHead":"262c2c4e56b8de0c602251e9ea0ac3546fd2e28c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.12.5-051da161.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.0/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-Dssg9kwt94SSjW41tK8ihfErtEBNpzxjEp3x/skIVMJMclY53OOJfXNyr6DT8XzXdMIjMq9SuriGNcS8UeK18g==","shasum":"525c7b5f8d473531f809442b22fb60e0903225ca","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.12.5-051da161.0.tgz","fileCount":37,"unpackedSize":146882,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEN1AD5OeCowwpflN8f895InVwSaQColHXFGLFeE33GUAiEA5w6vNTO7Xzh36yx38nI5vsvq3H0qHcrrV1x3CdPluss="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGJTNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp1VhAAiIQB5SN+TjOx/wWvtUhIavGnhaE7anX2LGR7AMreIBrtvt1a\r\nCuF3ShuMARnAEpxtvNGwIDX/6c/dql7DXlOhDZ5x/mSEkUg1eog1f1AnWJEa\r\njE00lbf6J31p7icQulkTN0nJlFEMlZdmtCYRx4RLQxdMrLHqYJ7wJJE8LWSc\r\nj9gE+cgvxr9O0vRX5AFzfBTaW+ioDhqLkzwmIU3ArhWCxtW59UkxDpJFNFNz\r\n6STerRQFtE+gd9zZpZKxZX3ccY9hN95Q00bjR0uBysVzeDl9AAnCUWsvoHmk\r\nCv3rjsLHnJdehX+qV4GPGNwNqgYOHkjQkTmj1u4nVhAAZ1cS1HDnbKmmmnbq\r\n1g5axw5PQY5w83RFWedgBf8f025rLMe0OsRKH6IcdKIl9ClB6nx/uEypqCNl\r\nB49urdfef7r2EuGdQUZSQARHGXNL0ajo6yPfd8a310SEKDo28Kc6YekgBLep\r\npdVpiGoZ/bGVd/6ZVhtWPt+pTK0BM8mP/2uvz+EVORi0LZGW0MrKjAGMwZnf\r\nz8O41dVTvLzI8SNgc8gp0SN3tYTRxWZVg3p9aD2w9DiS+RcejCjA7LlFI1Kt\r\nwXviA0A5vAcHRHisV17YK7IVsCfivO5UYUS6clT8IDN3o418Cu2PE8p0dKvU\r\nGwLzs/ZqXv+lh5E7UUqBMNXDRE5hNiR0IKc=\r\n=E5pJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.12.5-051da161.0_1662555340847_0.19037150248715795"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.0":{"name":"ipfs-message-port-client","version":"0.13.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.0","ipfs-message-port-protocol":"^0.13.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.0","ipfs-core":"^0.16.0","ipfs-message-port-server":"^0.13.0"},"gitHead":"89aeaf8e25320276391653104981e37a73f29de9","_id":"ipfs-message-port-client@0.13.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.0/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-7tV5vet/Pw8yQf/pa+d7jNfyRqbnAKO4a1Vb5jK1ReYAr5KAnq/PErptQ4Yt8fbPZhxSb8hpJyVLevcQDf0xSQ==","shasum":"4db5724a91b19beab93bd0e58c0b15411b0641ef","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.0.tgz","fileCount":37,"unpackedSize":146816,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpBT54yo5yThU8xhfz79h6CKMOVMV4Dzp4W5zoGWXDJwIgSj29OYQzZIcr92m9LaTF6tymEqF/rIXVv1+5Zk6tnFI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGJ69ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr6fA//S9plTdk73zKy2Uin19j2svPHpOdmXbG7AMlrsLGr0/u4luZy\r\nlsy4cMJ+uOfaPdV4jxdv6VaaiQYEbqKurVPFo7HPD6NgnSIFVwVMjpOhNErk\r\nNTKVNvnu85/NlnD5h1wZZCH5nzjR66Zyw1BsH0mXSXPlf+M68z6vQPNAhfZ8\r\naSz7eOguxvA4nSzrdOVKq2SRpNVngCbsc3ipbDqL0n8+uR3aa4kuxKmJG2B/\r\nqabUrqCN6frn41JC0rnu39FmlNgCCoN1wZO4CWVCOkV9LCYhHZKXBSKKbEHQ\r\nDcqdkVAkDfbSug5XHLtSY18WRZbpryCvUqJrW5z6MxQvIvSSpVV2tsMDEfYt\r\n5p7qkoglzyutLILh3I6DuIRQ0ni53sXoo5cNZls3Dmrcz2oN+AG7hDgQWn5z\r\nOpsiqVbmwfRnOrPOxewB0WON6i94hMTclkHXrZfW6+foAxZ24C5gPWQtoPkC\r\nU1WgVfrw7LSQ7JJclU6h/yxbIUSdAAhRdwy2RCxSQsP1UnknMxEnbLCCw2Wi\r\n7JzVhKyYAIoLxCbl66i4yWVjIkfrzwFqwJro96VU8gfpI4RXcNCgZPjc3H4H\r\n0H9oTAsEZ5xaMOR/rRjcXfe9pH36bFWoWy9LuZTFKCOxMInFdUWaU7t+fAVS\r\ndkQ7MrjIz9no8HyH7KR/v4T1JHqEuQtfhhU=\r\n=ewlV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.0_1662557885136_0.6871177982537473"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.1-b5456882.0":{"name":"ipfs-message-port-client","version":"0.13.1-b5456882.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.1-b5456882.0","ipfs-message-port-protocol":"^0.13.1-b5456882.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.1-b5456882.0","ipfs-core":"^0.16.1-b5456882.0","ipfs-message-port-server":"^0.13.1-b5456882.0"},"gitHead":"bc139649f4cd3840696282fa6dc6b241b9ea1833","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.1-b5456882.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.1/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-hGuaL771RMdwjK5G51UQ+EvgdLZqOBAfwHM+1tqGFPoA0tz4inHScQVpODcRW2//x9UxnirH2LCzPJMUpye8Rg==","shasum":"3415b7dadd81b313bc713f133608b24a2ab2bc9b","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.1-b5456882.0.tgz","fileCount":37,"unpackedSize":146882,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBLmieli2ZzqT/Dbqxjy+LY1Z1BGxOvdpLCDkFI91mcnAiEA2HzXR5LpYZRa6EdBafMofEZDBfyPi4MlxIaEJwhe2bI="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjJEDHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr/DQ//Y166j5y1d+c+xVFlLw2m39zi7otN4c0c6xVhHKoEv4ZxObg5\r\nBpTpaUKrGN95vszFQh0kUdEAEgKp9SWP5o2BBjCyWyAjTJ6UQBJ/U289kYIt\r\nfhNasOBEfYVKrVaMtr/KAuLF9xbxxE/N/nCdOTK+JwB6XxFRaIGvGELBkuvy\r\nLLjrCWr+iF0f0AmfmWyXI3PUQe6jNcQ2RDltrAuzpkuXxwENCeLbaXkOm/h6\r\naJHYN0UHLvVCUCUB2xs+q5v0XkOygxlM03a91WKmmOROGWQ7jiiZ2Yi+Q1If\r\n0+6Htb/SjCuBOPaGYvW88pavX4CcG0IgkBqUW/nVE0CPGOyXLj0Zk445gtD8\r\nnWN7u8R35nco4bSsbirZ8ITjjaKpIbYRsPY9Ap6if3izpAxav0/4zsfY4crH\r\ngoBTIcQtuQ0umRYV48L78tvpJ2cuN8BP4cJaUpc7pSlyojplbOt0BO8lGaMA\r\no4iBM+zIlq6NNpeS48I3LLmkRCQ3egOrACGV47A4QifdSOz2Kx8nhuxIK9iF\r\nYYXg4dPbsFthlEbs71oSfQp9tpAwL720TjrGKBO0v4YKcSbnb51qpKivGmvd\r\nSyAG502jbTupCqQNNX29pJB0y2SwVnasH4HHpG551q0IVTq/07ZnGw/zj+5c\r\nuSwX32RplDP8ZWRimSLfCd3NPJcOseRIyPg=\r\n=08iX\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.1-b5456882.0_1663320262874_0.006063945435991203"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.1-7c676f63.0":{"name":"ipfs-message-port-client","version":"0.13.1-7c676f63.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.1-7c676f63.0","ipfs-message-port-protocol":"^0.13.1-7c676f63.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.1-7c676f63.0","ipfs-core":"^0.16.1-7c676f63.0","ipfs-message-port-server":"^0.13.1-7c676f63.0"},"gitHead":"90802df6c68ef286b155c31dc4f625a9f29ec7a7","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.1-7c676f63.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-y71u32pDzJYBN1h+VmRtrP4XSBzSCsikV8zHVdHPvE2SJg4guwDHhGxkV1z/Jqo2PGxTcUvaQnOkkqEQ8H0FRg==","shasum":"dd3ec123dc94fc33a1e33d6d321d15b84efc07d7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.1-7c676f63.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHFRZEUgG4IQR4vJZZhuTnzG1iOPVTOf2VwFrFQi5PMDAiEAqk3UWrO/9kUCk4qhAUYURTyB0ykp1P2RsTFMKjNKvts="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjK2MQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrmYQ//XTWDUAHQavdk/lp7mNHWqQkl8YzWa3pItpfIF9bxO+C+8z2k\r\n9gOGHZUcWjTFExu84PkD4SPKVwlEWyMVvv53kimgSoqm2rn1/I3rFWDsdStJ\r\nByXRHMus8KOXK4xR3StW+nhEfeuA+mWMEJIVS7qf2b6KrhtPyRYJrUCAMC0i\r\neReTJtGabf31HvNoO8BHEOyYPTYd+2oZkx+blRSO2fvo088brAQZTdSffrrr\r\nS9uT9ffYEcWGGlgK7vsKV27xc6OgaJEMpVmoIIAWkNWb1Mw2FbmbHfr8BdUZ\r\n62URNV/sg8IbjfIMX3kIy6a8rgjzRzaZLicysW8F0tiorrjN/hXGKsre/laB\r\nUBDx+ThExR7SkwSMoBrs9GNmOAb6GZ7HK/YdT762Uo/IC1C86XrcKAHBxNmH\r\noI6u/UMegLVcXPcP2MDAN1rgMLUTD58aR9/XWmcoIcWr+g/B+XshChXUmDDE\r\nGTWljwMLXcHDuvKw9V6lvEEjIAnzVq+pFVxs8RP7jg7jUCB5QmgyderNWYZt\r\nD2PMOuF/Ev+T1/e0hI/DvlR5KWLqHQlpyHeckaf0LEJtrV1LntndWkjBxm24\r\n86en6nuq/PJjlS9ESU+9QxMSjpBXSsuseG1wJSOfZ6iLNaZymMqqJjR/Bql1\r\n8sJjM6RKVb/F2NOBw43PmdHKGEDiJ35CKRU=\r\n=hp8Z\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.1-7c676f63.0_1663787791943_0.5148492362997994"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.1-2a830bf5.0":{"name":"ipfs-message-port-client","version":"0.13.1-2a830bf5.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.1-2a830bf5.0","ipfs-message-port-protocol":"^0.13.1-2a830bf5.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.1-2a830bf5.0","ipfs-core":"^0.16.1-2a830bf5.0","ipfs-message-port-server":"^0.13.1-2a830bf5.0"},"gitHead":"ec3e046a48458e999e557f7adea92e304bd7b0e8","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.1-2a830bf5.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-rTobpy/vHRYAN6IWtcDn0HWhmflk6TtQ10bfo7EyS3++X8E0+bf5tPi3SX8QXurzSxKw7mgHeH9e+T3NgaNjUA==","shasum":"8b687a960f16c4a6a2cc982dae00b989d09dc5f2","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.1-2a830bf5.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDVl3c1mVc8rtjuHb/n8BpGEH8ME+uTF2f3tEp9VZOc4gIhAIQ/i7HkxgfrzEdUOBW4glggxTStYGxJ/PVjpvfBYQrP"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjK3nyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrGEg/9FCFzRb6j3s5YSGU/FTDgGGcWx024kBg2439IB1RhKvYOg0Xe\r\n4pl9wxtc6JP05dDq8uNL26ZpdKi+ZreDoFN3WCrRoVHGlSCd9XecZuFXICUc\r\nczFasHuQ4ctT+oYKhwjyMDMnRFGQlp63YgEhhfa2lO18ACMJ71HYNPhBCrQK\r\nU59KY9WtKxt8yYPtXygEJHkUFwsFLU9sqXjAniNYvo+S4CZF82TlQLxfT5uO\r\nqLwcYaCJ7fYTGeZwFLEqeDqx0Ufsl+mZsqWZMMkF3mGR7JQ5ZJZwCsXk1cwo\r\n9LlJvZ+mn01XMu5ZPxQVctl1wbwk/Tisk6uX3Xz6VlEIa9l/ZUz4mCFNWiu/\r\nL5KMaHc+hb/N/5arZhPBM3FZbDFPGuedpXpau1MGRoNKvEVS3gLcLvevgQU6\r\nX28iokrY8OgE6jXcxBJJxXYQIdDQvT9nR+2H5HCMkKcuT7aHvkMCyfPedPZq\r\n438K6KcmDMoJI+J4vsz6FVQ+WKWwwJz1t1tu7Hd69ZDCQK4g2HxV6lAwW/IS\r\nLSyGxFh9zUe7WRfWqWBEmDDp4qkRMiSTnUFpYruEj9rW8z8TGW8OkTg6UTK3\r\nGPa20dyskS7Psrda20FTQAsL0sODsyu/OCuLJfTv1nLy8mnymi6Iiuwmrj/q\r\njgcHMTgpjbPtMJWBAoR3W2qZr8/uCJapUTs=\r\n=zzqS\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.1-2a830bf5.0_1663793649996_0.6336116248726467"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.1-7304a0f4.0":{"name":"ipfs-message-port-client","version":"0.13.1-7304a0f4.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.1-7304a0f4.0","ipfs-message-port-protocol":"^0.13.1-7304a0f4.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.1-7304a0f4.0","ipfs-core":"^0.16.1-7304a0f4.0","ipfs-message-port-server":"^0.13.1-7304a0f4.0"},"gitHead":"95735ef611dd7b897d3d939e512b6229757532f3","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.1-7304a0f4.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-w+bROpJMomshjTq8UDU0ymoyNquhhkq7SobbBhvOPsnYXUFttpz6BLD90mOFOh5pkoxVi/m/uGxVLhqLGYTj0Q==","shasum":"2bca6417e6ad81eea658123dc0b89321efcef925","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.1-7304a0f4.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFG7V6uToArR5AKkP5oZSsnEATIncn6qmKDQDtSqu7GWAiEAu+8q7QdVfEQgPBSOftHBUjt02xcc3ufjpUMPd8J6Gfk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjK3obACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmorOQ/9G9SNAO3i6MLg1fUsQM6zRtnuAmsQ+o91k01Y1hIqHCak67u3\r\nYUZGgCHjVGBEPq2LngdiHHf7SrfxEfsxz+YuE6R/F95NMG+TU2AXui1hTQw2\r\nLpcSHvmMdJNE9snTqnfPOCJAh2mmZ7FC88z9VVQlCzm1unppvf1szNk/rfqi\r\nxTN6v3Qvqdrjg0kHBBYNNpSMCkpvkilkT1Ens7F4jbT3SxCclD8sSrfRfSTc\r\nXPYIn3Jow/fuaME5UGm2YR72blvv/6qLls+AElPD3+9KPNxnx0rJ5imdLmMo\r\n7JaeJROhcwT40RHthg4dyzWuaFNHnVUiTz4oLdT4WuN2h17PZa58nBpn9laU\r\nY1EHBXE9HRX7JynPxKbzW9KTh9tPUmXOC6ddYaY3ec0hsynZcjI/tMG598eN\r\nLuD3cfyDnfURO7o6vWEpxnGVu9zAXMXmhBVGrMTxH7hHecIpz9jA1MPOHxKe\r\nOBxDjuvgPDn+cWP5BV810YFUIMaEu3jSvoE47Fm+5demZ7F2/3M4vSlMCZhm\r\nrV/uQwHiDxABSgG1z7hakPLsy/354e3x0dkIN0Baj5zNpwMwwmQ+tuwR/XDY\r\nS3KZ0VCcidUAGGnSqm87EXEdwku6u00iMHe7DcCRzywEgE1UmQ+usHQodV3/\r\nx40zAPAPe2/2/xtGBFEKKSbosGVeGdDuB1Q=\r\n=jZpo\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.1-7304a0f4.0_1663793691596_0.16571191247897477"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.1":{"name":"ipfs-message-port-client","version":"0.13.1","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.1","ipfs-message-port-protocol":"^0.13.1","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.1","ipfs-core":"^0.16.1","ipfs-message-port-server":"^0.13.1"},"gitHead":"d1f1e75b2060c5c2e64d133a7a6bbabd2641e5ef","_id":"ipfs-message-port-client@0.13.1","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-pWwHYZYoQk7odOyMCHE7nzA/BlmzOWifS4M2kqvicNN2Vbyc0uTNP/kk5QcSQxk+yDcKXRW8JWIS0gCMZeBWFg==","shasum":"7a81d5ebe6f97d78da9debdb225bdfed6425f090","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.1.tgz","fileCount":37,"unpackedSize":146824,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC0Ns6X4V8gXQcCrmANM5ZfhocJRDtXVRzX4d2i3iZB1QIgGB873YImwgmHy0YVMSsAIPr1N6044jaGRcaJfnhTLT0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjK4g4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpQHg/8D3BucSUbLKXfb/0hkhOR79JIsGvHQYeOF8AToMaHukRzC2iE\r\nBiXaK2UjKd7zQoEkjPr0wNM+i1Vn59iT9prPaAuaMVZwErFI2U/BtI64Cr/B\r\n3qz3RzTQlzyQM9evbBNZx5CcZNXtayfOaIJ1J89fDlczuz/9o5+ZRIBXpjUb\r\nx5L6UYtoizfo26Lmh7EbbTCPIQDiVTU/o4pMUKMIXte5+0rAnM6nBzViO+up\r\nPWtyjfHlnEqnW2r/m71/qgGkkW6SzF8s9M1OTs7NNCRXAl7nELGkxwNjB0ca\r\nc7MRjd2hTVr+rtBGeF6kZqhlCqoNoAsbJQ7G/T+sDMmjIY7VCVSOIUlcRk2x\r\nyT+fa2d5U3uVoW3rf01K64ru0W5vaPoukAy1PDhjIkixYiIHnKmdJTnwOZ2H\r\nkqV4rf8MyUMWZ93r7aMyEGbyw3kSJRYYrl1fZHhO8m630xywJzOx3blo1ZjC\r\nT9cUGaPRYsRHq80NvL7LcHE3jYAGR+rnHB7nPIfR4UJ4gnxD26C/gtsn/JIg\r\n3ommHECepvvK3A1FWAeFGJvjK4rikRkaEMcM3KRz3+2nMyXVdXX8GyUrSjuP\r\ntSb67/ryJciL1B4keZLIcdCZwpVnfdUC2mBHtje9/Abbi2Dzt1pDz64VMpGb\r\neo6u2dBYnDQGDNLHn5GPAFkquFIcb5WJ7/s=\r\n=fCH/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.1_1663797304119_0.9697113544469991"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.2-d75e0a39.0":{"name":"ipfs-message-port-client","version":"0.13.2-d75e0a39.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.2-d75e0a39.0","ipfs-message-port-protocol":"^0.13.2-d75e0a39.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.2-d75e0a39.0","ipfs-core":"^0.16.2-d75e0a39.0","ipfs-message-port-server":"^0.13.2-d75e0a39.0"},"gitHead":"4233393ebc1f8526290235c1b52f4d459ff96e1b","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.2-d75e0a39.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-g2dGO1txQ5KSbcG5Atxr6b6z0VlE9BLzATQU6WHcaT6o4LaOGP4ztcVeB64DgMkujmb3JD/vLeFPe7jbXhgf+w==","shasum":"907a71f4ada6f1d5345eed6916ed19f33e5122f1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.2-d75e0a39.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGfckMQ2D+/2Ega/k3mpNx9P0Hn3ey77+1McNAIYn2r9AiA7JyUmAMqgps3KunUfP9IYHIDuSmjZM0wBaqxNfssXFA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLCJBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoUjw/7BN2aLBvhTXiI8tYOyQ9nARhnbKsz4y564bJC9U+FU26CfB+M\r\niDiFG4Nt3+6w5EndEXfqTaMe7CW3cF2KRAjmedIjp4Zv+PWQ1ELw5cMlK+MX\r\nOISZErfwhXUIRN3KJ7Rop+DALscNeR2tUuRPdw1akRRdCBJkMSK3Ifx36uDC\r\nIem+0uUCHTxrSoFJOG1JO2NmTimq1U80SP7whdsQEd7Ecmj4Ho6H3E2MqSw+\r\nKLLo03iGoPqZUfUbpFelnjkvhGqee2ocXQ4/TvuinjEFyAcCmYNmtavpNWZK\r\n2vLIfrl/qBpkN4bhSeQsv4cPuIF5L5xWOaTLVDfy4D7NQOhUuH1JCuD4ANIj\r\ndlzJL5Ai1Je+GSkVpXACFk1wn5YNTSrPgoBKcCuwbJ8vlTxPRM5kC+Qg5Zf0\r\nMigma0LVhdN+rBuVc0sK7Fg9XIxCfEHC9MO4x1IjnfZAECrPdh5YXwL2/OeY\r\nNx7jmO0qJug89KOlmeLtggPZdBAVmpwRr+kPOzK6wQBKNECkpatgbMImCAtr\r\ntylpsQYOPHsr7QR/ghKE/dApCJWPW8IeO2j5HQz5vwT+wKcj0BmkqbxT2k8T\r\nDw7u+Ei5LNCRXoIfGpwYFY1b9JumQVSN3s4N8cNjtgJYeIW/Yiwfj5FSca1b\r\nS8zUiPfDhAVK7C1Mi02nKQ/xMPqASPcwOGI=\r\n=NTcp\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.2-d75e0a39.0_1663836737284_0.389222027507635"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.2-d1b0a8a7.0":{"name":"ipfs-message-port-client","version":"0.13.2-d1b0a8a7.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.2-d1b0a8a7.0","ipfs-message-port-protocol":"^0.13.2-d1b0a8a7.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.2-d1b0a8a7.0","ipfs-core":"^0.16.2-d1b0a8a7.0","ipfs-message-port-server":"^0.13.2-d1b0a8a7.0"},"gitHead":"de2a2b2cb3fb26e858af2319c63296a1ca411c25","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.2-d1b0a8a7.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-cHs/JPA31bVxcys1ynCv49ExlayxjyjH38wP1SqIlFuxqeFiJNUJ/cFUa6mlyied18QGj+dcLINcLU4NkvqVaw==","shasum":"3c8b5f10af22abc52934a605836a701bcc70a0f7","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.2-d1b0a8a7.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpFZTonhN35DNEeJXcnWFMPAkPSQqobUi8CR7uFsDDxAIhAIp6L63A43lEhoFrXkwkFZ3tBDcq7T7FmjEVUcrnBFoT"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLDv1ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmowpA/8DvJ5eV6qYpkU0Lpoza7wGZgdN3Yi2nj9AYwwnjBAXF6w4+Fj\r\nkEObeaH4hDnEknEaLCsFtpMW3IxdQedcMhHWUyvwRPL6WR7brkt8ovPOOcDV\r\ns0XNSu5WAQE9N+xACGmN69/Y1W0XurjgO6DGSzLD0wpZrA45Mb4XTMDulQGU\r\nNnkCik28xDHkvHH5FGE95+jatNTGeLQiQbvLmwEiw8guTxiRXV6an+S+lXnx\r\n3hOp4mVNFoOX3hgccwlOErGUn+GKR7eMyDgnkJXLwyRGVdwADZABnxiwtzEz\r\n3RCw7mgt+eOHG9uR1d0Yz2abXGsHJBZf7YwQzsfftO0rm2pVmGaHd+ZcNotC\r\nafkcQGF8fK7TP5AJca7XTzHQGVD3r38xzTM5QVw+Hx7EzYLt3GSKY1ihZzxB\r\n6eD/JDLypcQHJ0kN+EXk8mSyESZ4a3qRK586bYBGyCl33vq4HZiBqcjHoewJ\r\nv6gVRIzJHxOqXDPWhmr7l4D0XpU0lJjEsdj/dMXnqgMOlvnYbZXrNd4/Z7u+\r\nY2IMXngbZ6qAwVo5Fxcfdfdwt10A5wxh2zazMsT/S8any6edRufvuvzYytdp\r\nHWzeMo3wYHa6G5qENywJcaypyAEZHyMMMOzn3ctBHHTRvncf7JQGYHETQRwX\r\nLt2iH/NZdRk6gUC+eTDx2Un5O1l47KXOSWw=\r\n=P3oN\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.2-d1b0a8a7.0_1663843317353_0.7035105427450796"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.2-acbc1c62.0":{"name":"ipfs-message-port-client","version":"0.13.2-acbc1c62.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.2-acbc1c62.0","ipfs-message-port-protocol":"^0.13.2-acbc1c62.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.2-acbc1c62.0","ipfs-core":"^0.16.2-acbc1c62.0","ipfs-message-port-server":"^0.13.2-acbc1c62.0"},"gitHead":"60666473159284a7bf9067d10436033caafeef5c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.2-acbc1c62.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-niHIimwP0H+dQdhrZPGzjIgxnGbcnbBuKQpuwtzChV8pSJ3jcxdCoImaUMOa8iMPn1e5Xr3HB8w21Zj10W/oGg==","shasum":"f35f5d1a6e03e4d071b2270aa8ca0227a63c8630","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.2-acbc1c62.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD4PD1aJ08hbDARFX3l0tl12VKLT9/aRPMgnKVJs9SMEwIhAPV4UpsW03vqamnpbs5gVBHPc0hBBIWWQ5CPSTEFQ2jV"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLFxOACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrlIBAAogcfOQ/g+HK3CbWprfctbs0ldxyKJhgeGh460qic40wC6isE\r\ntwKKDojctc2+q0BrMx/YGAxgpcspr2A6R2cAGkrutSD92kVAZQZ3tT/U8OOc\r\n2mwaroJj0tv6ixI+9iW5dCfUBdI0TfGN+0piAHDMqDw/ZiGmzNvixXxkX1TM\r\nw7sBQNmkbLryzWIUiStoONGp0gU0UsiGrgQXN5UCyutvy/aFfMwEsi0Hi71g\r\n2OKNzfBYsaBX//RSZemk2uYV/lM/btSu3clejfWFXMEeuyEZ/hMOKJZyySCG\r\naoin5amujzV2H2hgN3rl6laCIkGFesXUsT+Lbhjg1ySyeBfuunzI5Hao4530\r\n02U3aXlPp4m0zbwS8UU3xIPzo+WxiuGnpLs4QpqBCOGTv1y8bILmeIYGlKzq\r\nL3OlNTn9yu2GtXFxA6PiOtJF6B1+uxHCCGae92GUDEowJOVH4oxF2w4Bhpp2\r\nUWK/YjTyv3Wm/P+VgOSGkxva2qrniB64vOV3CXCqeBwa6zZFQ0gxR1sR4g5t\r\n+TTnH0cSsHfozq2scXDfsCTePeyIf60b3njyGTql+6xcz5JnAUBzP1jrZIeD\r\nzEH31o1LcI9PkRztvgyfxOzd4/ody1CNGykzvQBQFnZeeozOCmlE4DJHX4Ml\r\nolmihudL94rjFJTKNWf6Lkp6jovfnO6CD/s=\r\n=8oCU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.2-acbc1c62.0_1663851598555_0.060596229557118075"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.2-dfc43d4e.0":{"name":"ipfs-message-port-client","version":"0.13.2-dfc43d4e.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^1.0.1","err-code":"^3.0.1","ipfs-core-types":"^0.12.2-dfc43d4e.0","ipfs-message-port-protocol":"^0.13.2-dfc43d4e.0","ipfs-unixfs":"^7.0.0","it-peekable":"^1.0.2","multiformats":"^9.5.1"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.2-dfc43d4e.0","ipfs-core":"^0.16.2-dfc43d4e.0","ipfs-message-port-server":"^0.13.2-dfc43d4e.0"},"gitHead":"4eac92ae987d3ba6007c4742456913c865a06857","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.2-dfc43d4e.0","_nodeVersion":"16.17.0","_npmVersion":"lerna/5.5.2/node@v16.17.0+x64 (linux)","dist":{"integrity":"sha512-cVrSXT96pIYtqDK1nO31f1suGzgrhogMZo32hEoSqW3yiRER+dC8yvMF5eFqTP3MJJYhTPQqoNPRcZ5JhnwhNA==","shasum":"460aeb4e8be1fac9e897b64b592a4ab4b5a92c81","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.2-dfc43d4e.0.tgz","fileCount":37,"unpackedSize":146890,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCinwjAwdJSlhNuRT5nU1wOhIadNkqH5Vk++wwVwThBwwIhAMW7fp/xaDdW8dBu95OeDK65yRH+PyndtrEFbZ71+NRC"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjMbUrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqS5g/+MmqICHRpt9vR37YOZbIOR4WTc+VY8i9CwSl4KlixXKTmgwwx\r\noWval7lga2/kx8+2UXPNE5yy6KrDjKLqSemvNUnuFFl6xmIUA72VcUHtFJnd\r\nbDpw7wcytGlRMssWN/gEToOf9JJL9eufjMB6n62AmnQeVvmv78kF6kZbvRx3\r\nvTRcqglkHI+moqupcLMLWigy4eh52Ng6pNpp9KQ/0EkyPjOaBXuo9aXMycsq\r\nPs3sZnwFM+GqT9CmjH8Hkye6EGtewUtU/9CiHYi+364zpllnTZ8B2QR7TYGL\r\n6uRu5pc4t4hFJHkKfts9eCBUAxtV1tIv49rzRVUHj6hLNrU/RFQqdiOnLK0g\r\naKL7woXJ69FOqVX9PcRmPRJwpRQeTJCbwrf/lgLKuGqtaCW7/httdjMQTNzE\r\nJhj5xBcEkEKqWZfV0+eDIzqsF4HMBeW4aLNfW0D2GScudJDTdY1muP0uE2W0\r\nYmzG+AX1/Y7vVP7Z761WVHmi3Xcx78XGRWBjWaAncNlSI4+8YN//BJ/3pTv9\r\nJNiTQItIMB6PfeIupIqtEvKRqIjEscwht1FSXhrep2rSxH0kh8rq4YgtUFHx\r\n5p5N/D2hNLtrr2gax2TYAcUZyhPttMgLs32af9KeUo/zisplJcIjWknnQ5tK\r\nj4axwLeOWzO9VDtOg6S+CtCDgifgxIThEWE=\r\n=3X/U\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.2-dfc43d4e.0_1664202027492_0.7390784449640071"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.13.2-0cee4a4c.0":{"name":"ipfs-message-port-client","version":"0.13.2-0cee4a4c.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.12.2-0cee4a4c.0","ipfs-message-port-protocol":"^0.13.2-0cee4a4c.0","ipfs-unixfs":"^8.0.0","it-peekable":"^2.0.0","multiformats":"^10.0.0"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.156.2-0cee4a4c.0","ipfs-core":"^0.16.2-0cee4a4c.0","ipfs-message-port-server":"^0.13.2-0cee4a4c.0"},"gitHead":"b44ea59fdb45d3e8532d6a2d5f670e2df46d36ef","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.13.2-0cee4a4c.0","_nodeVersion":"16.17.1","_npmVersion":"lerna/6.0.1/node@v16.17.1+x64 (linux)","dist":{"integrity":"sha512-NWoFD00gwosDKoNN1EYQaiezlMD8jWdpHigKWx+t28ylvU/Q+1Jb3h/oYWLoqMbwXfYZhu+mkdCVJ1ux2yJnaw==","shasum":"ec5c4260739f6bab77c2a6e80082ac33e4301014","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.13.2-0cee4a4c.0.tgz","fileCount":37,"unpackedSize":146930,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIExf7g61EVf6HG7ibztySwFGO/v7v4eu0RPBYGGM9jqDAiAsBiKzaQjKfoO7B0mmQXZyKNkCgdEfmFiCIz+rcLV+KQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjVlc9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqhGxAAkmj2vko3/Stujk3SyCsKXSlUMVGKCxB5KVl4+tIYbLIKOXrg\r\n4gXUrsesJdJ+Pvl0ly7iAVXsMhB3s6gqtYK1t31L2Hf1QOToCJuL8bKDaKtD\r\noA3XpdLAOm9AbcHbf8WZ+j+rOk+0edySJeP+IgrFFMj/jU+RsUHYR9a8Rp9M\r\nmbnJ3MA5v9Tf1QD7Is7ZkiRcGzn2UjYLGgoBVpueANtt9JEc/7H5bBNedCcQ\r\nAfEYVoX9rKmLk/QMJZzGbPjBOnty/ac7xqiZMevClK1KEP5rUuTftgeAw/YO\r\nf3NTRdJRtoi7rq99HiqnsD6GeXJHT7dyZ0HELZmZkf1TVKtic4yBF3V2ljiJ\r\noJsA88eBcILvt3XAE4ekcxKv0HQkFY0RSyF/mH4KK9OQ6PVFvbnA5UXgTywe\r\nSvDLcFxhZhJhndwMpJrAoA0GkOyLFcNs4+mjUk/VqHZFFdZZuULhqH3axnex\r\na/yij8Bye6JY2nHCDKNOhBzQdwmkYI+krMz05t5X5ZMdhLe0KVdXuBpVe7Sh\r\ntXbiEjof77KSAt5w0i5BwplOCQIp+WyZIP2WCnOClJdpNcEO6+t1fikcL+wA\r\n4YQcssmWo6uwMoAfN3tr6+Va3nkxnBn43KmeVPqmDvxqQFbOYsgyXPZ/YFKQ\r\nv8jkTIT6G3RLdYbbVpxipBb3i7yguqP58O0=\r\n=Swmg\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.13.2-0cee4a4c.0_1666602813264_0.39993537595858"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.0":{"name":"ipfs-message-port-client","version":"0.14.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.13.0","ipfs-message-port-protocol":"^0.14.0","ipfs-unixfs":"^8.0.0","it-peekable":"^2.0.0","multiformats":"^10.0.0"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.157.0","ipfs-core":"^0.17.0","ipfs-message-port-server":"^0.14.0"},"gitHead":"e8b7b66bfa98c2a1c0d0bfc19f698d7d00b6c888","_id":"ipfs-message-port-client@0.14.0","_nodeVersion":"16.17.1","_npmVersion":"lerna/6.0.1/node@v16.17.1+x64 (linux)","dist":{"integrity":"sha512-w9wQXkjHjxPjejJxECMBqElVlCCNe+hFOm0+MwXzNtIdJxkAzkjI6lbcpL0CNwG7HdwStPzQfZsvA4rRC1zQQw==","shasum":"109cd360debeddd19bf77b6ad4c6c6ccc58450a3","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.0.tgz","fileCount":37,"unpackedSize":146864,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDqn1NBpsWWF+8w+UA8qtZnPF3hketiFK9vr2eBayPyjAIhAPL+oF5GeKPUTh68EJnAke/tbTE2/2XVS6FYEtD83Gsz"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjVm1GACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmofYw//VkQmHdwJvm6xDNqILaoNZmWlblrsD4GcK65mS2yQAMWxLqhg\r\n0bYP7DRZPOQpYyo2V54YUOIxMUtZC3srO/Wv5ZgapXXm1NRs3dlg2YrNT4hA\r\nHvnnXk9aWqLualA9wHc4ZxjjLSjUt3ZYAD8zqafS8W2NW5d7IkmlOxiqYBLK\r\n+2KUjagAGrfC54q6AKKHvorT7dDsna00LqO7bia3Z341aVqXGwxJKQ5+iIOy\r\nd5OK3C1Sd5+UyMwULluYBeMHHxEuDRa8gp6vxXWNoBRxc/q5rKZYCTvKgu0v\r\njoDI0TAUIQdE+eMTiIHGj+UZrAYGbSKrHUyRCn2YYapPs+vW35BV0leFSkX/\r\n/tHXCz4CrAclFP0SIj2dT+z/Lx7vcLQMBjTaNOggdn9BTVli8cBCzPSpC/49\r\nIfykH1YxqTffnlBJxQ8ZT0M0hsTiDc/z/wgb5WYCivDaINb7LoWZCdefCVpR\r\ny+nDXz3X1sLpVJzBmo4+uzvEn7y4WTgdo4FS46+E/OhQ9KFsRD36/97RMUtL\r\nrYXkXFsYiNYSp21rQPrLrUaKl0MBypdG3j3Phnao/IMEiwHfTLSfuwc1mE6P\r\n0vULl3mpoJZja+Uxkh3iC2LeEuBamq2zMXqYgBLBx0cWOFr1xhpcHUcTGIPc\r\n8kQkrbx3Q9PygV/SpNd724jJairLXGiEN50=\r\n=xFr5\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.0_1666608454269_0.8421936691455505"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.1-a77e40cc.0":{"name":"ipfs-message-port-client","version":"0.14.1-a77e40cc.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.13.1-a77e40cc.0","ipfs-message-port-protocol":"^0.14.1-a77e40cc.0","ipfs-unixfs":"^8.0.0","it-peekable":"^2.0.0","multiformats":"^10.0.0"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.157.1-a77e40cc.0","ipfs-core":"^0.17.1-a77e40cc.0","ipfs-message-port-server":"^0.14.1-a77e40cc.0"},"gitHead":"a614528c55b8b22866bbdd2ffcde2e38eb5f578f","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.14.1-a77e40cc.0","_nodeVersion":"16.17.1","_npmVersion":"lerna/6.0.1/node@v16.17.1+x64 (linux)","dist":{"integrity":"sha512-dH1wtBNBohyV76Bj7vXB25vn05IHdEsikl14JfzxbTYSu+PnkOgNkPFaNKkS7vCcjSFASV6NhAiKEZ5uMwCYHQ==","shasum":"9327c3465a1e23fc1b6a226067205e4985dfaafe","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.1-a77e40cc.0.tgz","fileCount":37,"unpackedSize":146930,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCa/fYvsBAdy2vVxVEs8E54ISBAhHIH40gTbz9Y6gzeAIhAI/G50zuhYOTGrYylP5MDFqIz+ix2M+YucDJpzDdypzT"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjV4wlACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmopNg//aaRJx74hzbgFKk14ut4ds+Tgzoju8uPqna+6Wkafd7vQBBI8\r\n98Z6j82oqfo29uO8U1hM9upnUE6c2Z+u3GqNHQpUYtDILB+ur7tEezjg+9D4\r\nAgHBCDZuKMpt6kOJD5ZrHJyr/xyfU/Ad633uwvHgsqAT9SFgN5a64WrSDrtn\r\nH8a5rORB+T8MEDukLI9BpzUecYB2GaIAJDM4iI1rQvKO5fu2ptjO0JAElank\r\nK1n/fVbOKSK6tOOy9sXh6ko/PUcncpkm1KEjxFTiXrtWF5hMMVQredcTPUZM\r\nZqcyileueTYpHP/82BXsrYNZt4NQXd1Vb4C3kcQ1kzFVdsJZ55yR9TYDGjsj\r\nyK7F9yPR9+MI9VJNOvjGFIPcxWj2L0jR5zsxpTWsK+xeM7UvuyrBiDp2gVJV\r\nIX/dhXNDI3LyOvu2GtNBh2Ml3tls0OtOhcovkcqQphi5JjQvzN6xDbnVGVHg\r\nV1+2AkN0FtpSPnA512qiG4YKl8Hqd9vzyZat8x7F+5dbZMXoxWKzdD24jjXg\r\nEvGr/I/6Ade4tMb50N0G0Vmqi96NQxmW9kXYG4uOjYy3DgZ93A7w+BpFHsZm\r\nmtw6CrIwMz/diFLgyvF2VahXSbV9jp/kYDKJZc3xvMEEbyoifF9ulLJlCAW4\r\nsUPoUSLwVNO8lTCpf4SSGsarKpIsv24ahOY=\r\n=0Pgu\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.1-a77e40cc.0_1666681893671_0.5517118625915216"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.1-58e6f468.0":{"name":"ipfs-message-port-client","version":"0.14.1-58e6f468.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.13.1-58e6f468.0","ipfs-message-port-protocol":"^0.14.1-58e6f468.0","ipfs-unixfs":"^8.0.0","it-peekable":"^2.0.0","multiformats":"^10.0.0"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.157.1-58e6f468.0","ipfs-core":"^0.17.1-58e6f468.0","ipfs-message-port-server":"^0.14.1-58e6f468.0"},"gitHead":"2a13d94cabf2e6ca2f631dc9686f03de6aa42447","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.14.1-58e6f468.0","_nodeVersion":"16.17.1","_npmVersion":"lerna/6.0.1/node@v16.17.1+x64 (linux)","dist":{"integrity":"sha512-wPRkXnKo5+dgFL7xOKP/GEM1EKwfSYF9kMmeeucTSFn4p/E0IOh0ynDoVXn7Pb1KQd7GXNE8qz9KjL3a1HQMAA==","shasum":"5b7a5771523eb7619e6aae7e6a90ec27c6f4140c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.1-58e6f468.0.tgz","fileCount":37,"unpackedSize":146930,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEahGTuy+/snQUKlj0uF1Vp15ZUMX5jI/r45kUp4NrIZAiEAwOKsW8uX8+RnXFyVDAuOlnhl298vnay8j6pOu1uqMcM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjV5s0ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmob9w/8DIIyNXrbtWcRG8XocRKr1/MQ6Ye3WWwEWScsLFd8xsRo3MfN\r\nDKbfMpwO846e0K/gZvyf73/xId9BHAa8iT8tk+vicd8O0C1kKr/GRRiWg30Y\r\nNJmMyUO1l3UXtl90LVkFlXkQtebEpZuRIOCebBRyAY/Y75xF9CW9ed9EGNk3\r\nDoTE4OzYDXIb0h22YZML+2N/37DfBUl2n5qw8SjxtHF9XzvKIyrF8JuJLBYj\r\nb7IxhLgtqr03Q2XlPGfdjiHj3uo8udGL9JspipDPtipkrD8XPouLwO7r08wz\r\nF3DUs9DaE0PgauaciXs1OCa1OS2Wjp4t25ENTlqnzRjXWqCO+BFvwfc6ySd+\r\nlUHxNMqJY47W8hli9ACKE7e4/t7WmxDB+EXtiufaGvRMoBm0Mob2mSH8a/Gt\r\nf9Ti7sQ2U+D2DtImA99T7deFDdcQO3U7bxDYqFnn9lwXNWuuoP8HCghu7tCu\r\n8gUXLzZMkIwktmoxKNEbJA2GJ8OzVJIRqjla0OvHGHaN8OW9uDJztGIWGh60\r\ntR7/NxFf52V9WK+LDvQE6muBfsUkx2+lA2ffIbVt1j5dtP9S3F83r8gLewRq\r\nIdcEP2qOEyauPzuZ+TIrXgWka0p9gvsKwTLqaN/++oNTsJdNcK391MsLGCEZ\r\n2iEny8Yu5ws9hjwIRI/K2dbk7GhIytxnE4c=\r\n=mwJI\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.1-58e6f468.0_1666685748753_0.004983254633666556"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.1-6ae5eb7d.0":{"name":"ipfs-message-port-client","version":"0.14.1-6ae5eb7d.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.13.1-6ae5eb7d.0","ipfs-message-port-protocol":"^0.14.1-6ae5eb7d.0","ipfs-unixfs":"^8.0.0","it-peekable":"^2.0.0","multiformats":"^10.0.0"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.157.1-6ae5eb7d.0","ipfs-core":"^0.17.1-6ae5eb7d.0","ipfs-message-port-server":"^0.14.1-6ae5eb7d.0"},"gitHead":"848f64d53ffe001cdf63310c06e8f0ffe485278f","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.14.1-6ae5eb7d.0","_nodeVersion":"18.12.0","_npmVersion":"lerna/6.0.1/node@v18.12.0+x64 (linux)","dist":{"integrity":"sha512-YMda7MUt3Hiy4PEq8OWiXa3p/ZvczKopdsGVdCJBZOfIBiSxS5c28t+jJvKkqrDKkT8gbA0IaR4y3XlgDxOd/Q==","shasum":"e1b7edfb53eda2efbac4ed2ab153e030f2460c2d","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.1-6ae5eb7d.0.tgz","fileCount":37,"unpackedSize":146930,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDIM0D79WmyJHB80Ze3p0RCBqnbNw/TtWFGlrihfd81vAiBAM850fc+p15B8aDiDw/HQ4E2ZJnsUeBmv3GIlWPfajw=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjW4TzACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoslA//TV5tus/fMo0OILfSavqCf6xQQ3BwcPokrOLplPtWPC3Gvf7g\r\nULvVi5xzunDSh707uQOnHzGRuRALEoxBKaQcLcz+flNLaMfuPDMYAIWYgOwA\r\nIP0370oIGR1XiiAI+tv7MABmGZEsej0v5g7e0l7y67fvo+IX5OLxfAUeLQVU\r\ngVeSboGBOVeApz5FXt8JNe8/W9YVYUyRLoabBEAbjHaVGf2f9VB7nfkxLyrZ\r\nMlJMAtefPSGmGpuGkoSZoRcaOFLJ0nk1ixveJSCjKTaZOjBpuPu1jROssqw+\r\nFkDlda/F+RkDgSl9HOTx7eOgOzt4pWWuHCmXvcXJvBfrXNzi75zcop1pgAgX\r\nBluBCbriPFiySUbZA7wSYujMRvyNhcnpBAc2pYGqX3KzwVlQe1x09G48/dy/\r\nZHZTvhJhc11tZ2+7qPKBpOOAEtRzQ57g39f8o8Bfz5soxPghwreN8GfA30B6\r\n2s/pgfQqNacwoZhQjrQzc/kK5zxBnLIHYYiFK5HFG+vuM5cfWsmUEOjYhDfr\r\nQkqC0PQn/8GbMI62isXveKQOOkgb44n2JI6Eq1Ih5LFFNrJPLTNV1F7Ln+GY\r\nP+fPEEwB1Yb+VkqHFWWmNCa96rDizxmyXnqd/EZ4dAWTKWGtuBy4ekSzLa6l\r\n1C27DvCUXeW4o95CcquPRNYNjoWIkQ2nMao=\r\n=Rk6Q\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.1-6ae5eb7d.0_1666942195594_0.3782255668955792"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.1-6be59068.0":{"name":"ipfs-message-port-client","version":"0.14.1-6be59068.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.13.1-6be59068.0","ipfs-message-port-protocol":"^0.14.1-6be59068.0","ipfs-unixfs":"^8.0.0","it-peekable":"^2.0.0","multiformats":"^10.0.0"},"devDependencies":{"aegir":"^37.0.11","interface-ipfs-core":"^0.157.1-6be59068.0","ipfs-core":"^0.17.1-6be59068.0","ipfs-message-port-server":"^0.14.1-6be59068.0"},"gitHead":"81311d5fcc6a5512ed3414aa592bdc9e6c481b03","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.14.1-6be59068.0","_nodeVersion":"18.12.0","_npmVersion":"lerna/6.0.3/node@v18.12.0+x64 (linux)","dist":{"integrity":"sha512-sBYPlc9HFi/iyapDg/vZmCRrnogvIfhX8ieI5JB0h/lconFURDcI3dKAH5PhhGAW3kBeMXGLcM3twRN+97Mu5g==","shasum":"4bb406e72ddf53c833de24bd214ac89be3789929","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.1-6be59068.0.tgz","fileCount":37,"unpackedSize":146844,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICqR2cZflZXWVc6f7SY/7xFD6tMF+IJVm1a0cWx14xj8AiAGVDqHTrQASww0j8wXhJyseXZoDPWn4D4PF3Z+dr4M2g=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjdo/2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqojA//YFyv86+2boG/t8ZUJIkUAsdv+AeyWHgM2RTKaKjIw0LafJS7\r\nIG7L38mtlsHgCV+iSQ3mGn3Otknhio4cAdRrdsnZGEvuda0DpDk53iwPryLH\r\n9dznsyo0kLY4OOLJR0inZsm4WEa+i/5lODfFBezf84qUoXV87i4xFkG4Jd7d\r\nhmP2r/RLsKiRAXiYgqK29Ab7aQBV62HFb1jIIlStqLJTFtbrOhKxxkzl5qE0\r\nV16C/tcBJBUbvLgWMt/YhvOY+xvFbRotDa2xknDlmwYt6zoZBidOmhoDZ8yi\r\nBSKOs9246maoMSeclW3yWPEGseAbdFleL/w2TSmMVlILw62Ozvx6gw8E02pu\r\nxnjypH8Qa19mYyvv8VKzqywlKKt2Gw/ArtnI2R85EZoxTTs7hzTGqsRL2scb\r\n0LCHXWdb7Z6PbZONbU/F5rBPEtM9hzp5kypupDKhc1n8qxclhPNWx6dN/4xc\r\ncTl5uMNT5o+SunFU8KQr+wDCBpfMqNzOkWTn5EmR8timHIzwQBqr4UHwasld\r\n6zVMEHNC6hJ0F83ANe7aQEoup5aX6T3WIlOSpPF/y3Ve9GBUet2UNIlYV1I+\r\nmks5LZV7+og6ooovB/Bg3lVLROeFK0dm0/x794xHROU2n6AudB7ya8KhesIW\r\n1jasAmh3gglOgccuEBByP5PZVS/1FW/Z2ss=\r\n=q6dl\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.1-6be59068.0_1668714485809_0.4309635826877327"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.0.1-563806f1.0":{"name":"ipfs-message-port-client","version":"0.0.1-563806f1.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.0.1-563806f1.0","ipfs-message-port-protocol":"^0.0.1-563806f1.0","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.9.0","interface-ipfs-core":"^0.0.1-563806f1.0","ipfs-core":"^0.0.1-563806f1.0","ipfs-message-port-server":"^0.0.1-563806f1.0"},"gitHead":"19b0474216e0a7dd7363dcd6733379790b68a1f4","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.0.1-563806f1.0","_nodeVersion":"18.12.1","_npmVersion":"lerna/6.4.0/node@v18.12.1+x64 (linux)","dist":{"integrity":"sha512-3dYNkqEeB/u+BDAVALpVBSQkd1LPBngB9QnwZtVvmdN/rbGxlhX45dplxFSIRcTw5AaRPLfemyO/cXpJ+LYk1Q==","shasum":"1cbe5ae31afdc0f2ff847988d774f4949dcb65c6","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.0.1-563806f1.0.tgz","fileCount":37,"unpackedSize":146878,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCTHge2PprNymYWEsAlAXrEHk+0OtS0pKkNCXAXPR4VxAIgWnMrLYJS4D9S9cQER8mB+47qcxZlrRs1xz/YXBfemJk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvFjGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqdog//dFXc0J316fZB+NSMVyn180WbiFwgZfsdDPR8hfnLOe+z9tNG\r\nmqZApXQ9uoi6R0J7VZhlcGyG9N8g91lWIft67gDoPCBskx5f00qrZchtnz8T\r\n0enclPVXw1hBNteYdYzIgVJ5rEGHrBRIjk+kRz6v338t4jrY0FOZv+58nYYd\r\nc73I1Fh1yXuwjpH9L2NpzClCe5AidoW/M2Z7BPwaqG3laJ9KaOyGCXeKP7h8\r\nVac4e3ulLe3+NWKACYCFahETrVBhkECaULYYknJfXKd4Zo9qlB9O/Px9otbE\r\nFVy+jnhzodpCzn6IGoMUlQLwrT1j1kkDFRiYMxuq5YhWLAQjcJ+d3Yq9sFVO\r\nzfWdXd36342p7BzlhD6fE4kPrD6ePVWfG+Uq7DhC5GZhi0jrvg44qIrVIuQr\r\nrCumqkrqECm/QIEk8Shi3+5LN2JMGWmCclID/28/2B29J26K1frGqhrhveGf\r\nzaWBRyV1Zls/CWcdS8Xn7cUot0skH8rKyzhgNMJ5QN7H0T3KvyPDR0WeILVP\r\nNvJmJqJ6qBhtkCbi93bMQ6ENu71Q08WJK82wxu6OKqdcWYNAnVTACJ/1cMlw\r\nFhKTMu7Sq+IqPOZbJytomoSyQfpoM5/vM6oaHijGE8f51Tw+fxj5TYrylyBf\r\n8KNJzq7ZNMZPCZccZyDjfhVeE1cvhUySFno=\r\n=3Dm7\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.0.1-563806f1.0_1673287878629_0.5191250430447694"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.0.1-e85e5b6e.0":{"name":"ipfs-message-port-client","version":"0.0.1-e85e5b6e.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.0.1-e85e5b6e.0","ipfs-message-port-protocol":"^0.0.1-e85e5b6e.0","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.9.0","interface-ipfs-core":"^0.0.1-e85e5b6e.0","ipfs-core":"^0.0.1-e85e5b6e.0","ipfs-message-port-server":"^0.0.1-e85e5b6e.0"},"gitHead":"5d268429a92d15e22b1cbf7fafadca662b131420","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.0.1-e85e5b6e.0","_nodeVersion":"18.12.1","_npmVersion":"lerna/6.4.0/node@v18.12.1+x64 (linux)","dist":{"integrity":"sha512-+9xh8CLn2cgF2ciR0kP0dLl+qPfCBndi9T8Mx2ng9RJ7eU+xjHN5GQU6cKYovpB2KHo3uirK4QFUZFUTEyclYQ==","shasum":"43d274c9908e0d2131212f214b8b7e74a828270e","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.0.1-e85e5b6e.0.tgz","fileCount":37,"unpackedSize":146878,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAeCyW8Z5IGNZFv5d7eTPHjfnvS3vqyTBBWzn8o95K3xAiEAxCaSi26KBvnEjrE0TaC6xq+Jsdmn98+cu55H8oorZ5s="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvGf/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrc2Q/6AlsRW15WBxEi1+pjT56SU+Sl1Qpec4JYavh4oZTTgEdZ9QZm\r\nMC8oZTi86NSmhZoB1JeK6eCIy623Uh4ADsisb5Hf4GblLinqFgT/DeSuQ6MR\r\npiup49iwMFPJokyywRHTH6tbbaMCx/V7O0FrGDwXZ7Oq2VXj6wR/kXhUpHEu\r\nF6olvx/1rqg7zMjeJMVDQ3QDLBirXaqC9HgQFFxQci+TrquRdZ+Z9GtiKNHO\r\ngEZ0Y34Hm2ZEXBxBauErcUkxm0HiwY/pYxFJQTKGqjSDfeU3fOsy0B3dV7Ea\r\nsU2ZV9GhFaHvGuvozpfyHWDNwON065QUFGOsmoqowQIzK/aJmbvtQEMi0yO7\r\n4S9wMJubbyNjovj0MjOgtjIKbDKABujYGHtS0gNToGl0gRBsvFDq3Tlk+0e0\r\n3fge6oV/EalSNqlWqbjQpTGQJyXIEdGrhlSM5f0SXIRx+u2d1DF4sRVB2NCz\r\nxwxuHSB6A6s+mVJAZa0ljGpsSlE+Zdk79pe/Dr2fAg61ITydXISZ68u/5goW\r\nOy+ybBYV8WkWMU74TNzJd6GFTYtQJPD9bDv3UXGmc/ppJ9mb03p2zjRyPvUd\r\naAuBadmol7KzXGoafnqdEMdpJf6TermKd/Pjphx8Uno07Ob5kZLVHXX/xyyU\r\n0+jj2paSsOlGpfJFJtFyfJUtiG9XISptIVs=\r\n=XKOd\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.0.1-e85e5b6e.0_1673291775658_0.980259879268981"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.0.1-2a6fede5.0":{"name":"ipfs-message-port-client","version":"0.0.1-2a6fede5.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.0.1-2a6fede5.0","ipfs-message-port-protocol":"^0.0.1-2a6fede5.0","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.9.0","interface-ipfs-core":"^0.0.1-2a6fede5.0","ipfs-core":"^0.0.1-2a6fede5.0","ipfs-message-port-server":"^0.0.1-2a6fede5.0"},"gitHead":"12b210560953c0358e012a120d162b5f3f32d06c","readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","_id":"ipfs-message-port-client@0.0.1-2a6fede5.0","_nodeVersion":"18.12.1","_npmVersion":"lerna/6.4.0/node@v18.12.1+x64 (linux)","dist":{"integrity":"sha512-S6m7bzLcejM5y4SCkxKa1mzo6nduMla7iSmsBK6PaUk7bNQauyaGNpsZ6FqLVSOkUcRzFb37OYutqReP9HRMhA==","shasum":"9cc070e8260421bf36dd26225ad10045c4046be6","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.0.1-2a6fede5.0.tgz","fileCount":37,"unpackedSize":146878,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5nknAgP1bdEcznWzkjhxBHwu4wu4RpavMqa4gKCG2NgIhALqoAAqFfQnOUYS3g8IxF5QrmKICgeGIjshSl1PSIC4b"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvTGBACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpq+A/+KYMfHrgXaG2LHt2DDg9c7LNyj4TSDd6LeAmT9VtjWk5XAZLV\r\nn7VErC5zX89LaNpzj9/K6kXg1/EH6Gt1Qx8eAFNG0zAOD1KD+L/h7GIVoHLW\r\nBtr1P99Xkn2YvAj6e57kCHJwe5DICRmnyrQTWhYI3TLTXlVF5kRNiv9Z+sj0\r\nrS8fhod0mG9zOhv5Ji6ZAdLbH1XHssUi7CG2ZzLPCANWJSEb0m4es8tK3OJ2\r\npy2DvOzBIQ+4LqrTwVhGKIfo09N95gdYBVlZs7gCiPV7W+6kPYuTQ2IEEgkF\r\nuaY7rUJLCvhrlbSONxjqa0jcILY9DVHscqKcRmwASMc4Ha07vmNmaWaU3oLg\r\n2f+wsl0q+fSCUSPnz5po/Asg9MaxB6s71KtQeqfUgmxV5N6M5EKVqYZHAaDw\r\nsSHg9xWbRpGXaqbKp2EYkY/Gn9sO/vZwp4xcq2hfwDwI43XLwxd1twJUd4ZD\r\n8I+1L1vDz/L/hAT6LsajDZl/zc9OMM5/E/tnYWFzHOX0MHumwwKbQN6USUrN\r\n/1en4fm/M5/kmGHBRzHkKNSF2IKebRjIe7lZQTjsVyzzNsAtrXZb2fDho2Pf\r\n9f7xljl3mF94cXPyYk1Vu0C5XGvbbJsiYFK5BZ1tXgzuhM6vtJjfi6VjaE9B\r\nnWkXw8VPcg70xBAo+ZK8CrgZUhx1Snz+jRc=\r\n=+XP9\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.0.1-2a6fede5.0_1673343361169_0.8275995462761905"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.0-5f73ecad":{"name":"ipfs-message-port-client","version":"0.14.0-5f73ecad","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.13.0-5f73ecad","ipfs-message-port-protocol":"0.14.0-5f73ecad","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.157.0-5f73ecad","ipfs-core":"0.17.0-5f73ecad","ipfs-message-port-server":"0.14.0-5f73ecad"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"5f73ecadd7d397029be8dd9bc0dcd82469f07359","_id":"ipfs-message-port-client@0.14.0-5f73ecad","_nodeVersion":"18.12.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-ZpchAliEpJjD1K8qt1ejS2IFxoa3JFrZH9gPJJ2+UsMzIRuVpF8OZr17ou/gISvNSxlURYIwAT2bq9g7NPwqsQ==","shasum":"1ece3114e9cc0e4f297db05b593db2480f671280","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.0-5f73ecad.tgz","fileCount":37,"unpackedSize":146812,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID5GsyaDHB4xYS4T9qtSfCc/pH0t6zaR4igCrJbdsx72AiEApQ90/e4B/ytS6P0uHsXGwyocpM8hhL9JymO3bm4P8No="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvZ0iACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqspA/+P8VAg05PN1uS1PO1iMcPpDrGZFTJ/39aDnu1wR0XQunmi7ka\r\n7FNtGh7PcmJ2fLOMz+wlQ4k+awR4PM21V/FEAy/2I2+uhY5lS/l3M97ZW2iT\r\nb9HB0tonIFyv6MUJOv5oaPZN7k7+XZ8e4OkbXgEN3wqqjpDXW+UsK76fgWnY\r\nknCPNJeF9HubFOkfjOiAOvS/fg/3m+OvTFiaCrU/1Om7CScwTpk5OCely5O7\r\n96KXJqHbboyRGW2z0ksrEhBqkcEJQmN2lFiF8cN217/TappWJhZl0gttLgi9\r\n3XRpaVtncVHM+vijmOOyhmQLib7DmG9wC7Ag1AkpacocvOOpda1lv0fp2SLZ\r\nG72wNVfQ0zqzok1sc0r0Xb5ZRALEHwE4jRFS+6bra6VaxbmlC5hp6o24lwYh\r\nww1cZrI7fxNFiKhqRB5Tpzp7c+iO3Q6JpyJAqyyCXiema9qviAzzlCPSJOw4\r\nBs7nIR4xZG0rcDCr3+uCmvqCvm/KfpC8JbMojuyqMuOCJ6DNekwWIwQPycOy\r\nfjtU9KsnYbk7Bqqm7LgmJvGoVYZ4DSKBii8CinT1HDkmvgNwA5i17yXlyeEN\r\nMOJOoS9Nt1Pj2EQjRzFkzr0dix8GYmO6BbXtawWqhJRdElD/t6KRxJuf8Ew+\r\nypyQf/TIjQY3lsNPb9P8BbvmPpmqpUaiMeI=\r\n=4PVb\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.0-5f73ecad_1673370914294_0.7170205487016648"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.0-4b4c124c":{"name":"ipfs-message-port-client","version":"0.14.0-4b4c124c","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.13.0-4b4c124c","ipfs-message-port-protocol":"0.14.0-4b4c124c","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.157.0-4b4c124c","ipfs-core":"0.17.0-4b4c124c","ipfs-message-port-server":"0.14.0-4b4c124c"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"4b4c124c4c49b1c60a68b4b8e24f1f00dd7f0517","_id":"ipfs-message-port-client@0.14.0-4b4c124c","_nodeVersion":"18.12.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-Ht2XfsVdcVkDuM4jV5vV/a284NcJwZk/uG/zqaS97FDm+oqf0cmOhIjxM7yk0LEYkymAqQTg1VNdqC3VFDN07Q==","shasum":"e9f9252970dd56fbddf4f18c7812191b5d31ac0c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.0-4b4c124c.tgz","fileCount":37,"unpackedSize":146812,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDw2Rqs38XFujZBz4SFmpYdc1IPOviV38hjg2x0Z6pTzgIhAOBxLGW1pOyQv9EBow14QM7APOeZUE4x+U5zyOhe9pd4"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvt6RACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXSA//d1ZDnJTy+3pf7FBInWwIImw0PDCEK2s4BaQ71nFmnuqchxEw\r\nOeGhcC/9NRY/xgGw3cdFdQ7bsKHn6+oy9k2ieI8YpEpzeR//VYeEa3Exa/6Y\r\nh3c7Vbjdnlne7jKbISPksZT++FXd1ub9GEkrzoN4kctsNzOKseROdA72HM3J\r\n3RBh+YNdqeD/2oYtxtL/nXtLRSfVuHkup25qsp/1thtLJD4n1MHIel5UjMp5\r\nAYgDFyRvFEygwlFEtVF3sI08zgqf5P9UW2fs8Gh66r29cP4phx14w18xdi5L\r\n41cFba8zzH19ajkBi6QE4MwMneGg1G1vXSD+Ij+/xjLzH2IEaiqgHCnaZan2\r\nJp99JdXDC5C/Is+TZO8C6etEK5qjSUVJ5H0DutTVnZKSdh/iCK3UecwEahun\r\nGbNhY9a3MP4I8En2z3WJjs3llM+j+EN71j6dR6Fs+kcvfUuRVMsPV6Hq5rG4\r\n4efG1MrQ2NEu0CYtiaPhzAJDN3ItR1RvGnWgniCwY8B/qVUKiBeqXkbzq5xr\r\nsn9m1vBiBauTAvxjM4D+74V+OPWl6OE+iB/Yzpdt0VTXbKAnjdOv6NxVdTZ9\r\nlgz6ypuiiiBG8SDY+pLToJZ0SdUqshU6VjVmFYCbQEoRcR+PaitwR5ht8DYS\r\nkr9NlpEvCUU+VMa5LJ0lHCzQkS7H32bL70s=\r\n=okNt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.0-4b4c124c_1673453201039_0.10846006163132227"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.0-789ee585":{"name":"ipfs-message-port-client","version":"0.14.0-789ee585","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.13.0-789ee585","ipfs-message-port-protocol":"0.14.0-789ee585","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.157.0-789ee585","ipfs-core":"0.17.0-789ee585","ipfs-message-port-server":"0.14.0-789ee585"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"789ee58556083ef71a4ef44e3358f86c5be101fb","_id":"ipfs-message-port-client@0.14.0-789ee585","_nodeVersion":"18.12.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-A/R0jerP4nURCNYXf2/BYx4KlgzbaMLd0EqQTgw9OFxb+zIQ70JfP/RroV54851UlWEfmH3qgE3XV8MKpbunrQ==","shasum":"d5ba7b5754d3a4f88a8d41b257b26fe19c118e80","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.0-789ee585.tgz","fileCount":37,"unpackedSize":146812,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHsC/0tlRuqmcQqlRe+wNpHyS8/YIbaCOaphdzmE/4WlAiEAg4DRm5qJ7YcMsjSonhpO0+hQq5oxLxbSPZU9dgXgx30="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvuyDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqwQw//SdxK0/pekscKNX62p55WyvaZNjToJRX8K6h1naDpM0iNtYJ/\r\nOcx/IzPd5xl5gIslsdvL48nYsvfNJbCfauc+8pVl/B6eKBHSFyWfdHCvsI6A\r\nDFCBFKAHgxprWXe1Cm91yET94dtS/+BZAWKVNN27UtVeClCm3IJfKU1hotSK\r\niRsgklODs9fkEPEK4uFgOlRi7cnhjbQpolbyN9+yj3RvoXAvtvFY1Tyrox58\r\nCYfj3z5fvxbV4Xqk9U8C0hiXosr8VWhAk1rDfoDHhaZos/UvDkbECoegLxAx\r\nChwRVP+QsuaHtqNnPosxT6U6EAIF219ZnpYQhnbsdrRYpizEIarqyPBG8lwv\r\n42+tgJbCnZ569tLJbeSa8toEseX5uKBn80ODmEG43qWpe4KaPOPD6lQAe3WM\r\nxmgh5NU7xTjy6Hs1+/gB8k9UC4Jp52wDQHamczucHnC9vjIgETy7uGkpHUoq\r\ntMDgIvMv9/U3Ay6LhyVUNkRploTwSs/fc+w/ByoYndc4efB/79b4fp0SikCF\r\n2Muv+Rdrq0fezREAu6Ob7Kuw2p5acpiFIJqi6zzPgOrec0TZ1iZ8mYkiACoN\r\nCq7uQUhAWmoLJijeB4FC3748sJBbuvCYTEAmjkJ/BiK91xjLfwBSdiUN2KX4\r\nvHgWEmswim8Ul+s63sV6W+5UzMVThhsG1g0=\r\n=iUcH\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.0-789ee585_1673456771417_0.8044688163998417"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.0-fa578bac":{"name":"ipfs-message-port-client","version":"0.14.0-fa578bac","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.13.0-fa578bac","ipfs-message-port-protocol":"0.14.0-fa578bac","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.157.0-fa578bac","ipfs-core":"0.17.0-fa578bac","ipfs-message-port-server":"0.14.0-fa578bac"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"fa578bace93e459849a0ffcebbd6f222dc05652d","_id":"ipfs-message-port-client@0.14.0-fa578bac","_nodeVersion":"18.12.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-SMTSiERWOqMqPBH6ELIZl3rJe6iwQmGTuhJr+xfm4WR0IQmmCe0lAU0O0KCVv5Ky5kGvBTfbbhUtMcF9gw/sng==","shasum":"5efc3c715deba9f71577e4788525f0e2d4b3626f","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.0-fa578bac.tgz","fileCount":37,"unpackedSize":146812,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHY44+SGPS2gv/CdNu9VZEk7A9nnxpd5zQKDq/ZLrZjvAiEA9PFFVo71I4qAWHtdHANWFarW/HxKAyB/KzK8QUEc0Mo="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvvcIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmon0A/7B1bkkwHJr4vUCK1+n9AtIKgO5/Fdp+yh38cXTLvy+lYDgJ7a\r\nRnx8QW43kkpmTsFrOBI2TT/5A9KkZivzS/9/HSnFwQIl1HKL4JhkJAL1lkcR\r\n1JLm3PBfnPKXseaMhAVxxoJS2mvDIqS382N6cexZavGJNARGR8mm6lU7TyS7\r\nd9BwXlY3HDqWiUjk+CpV1yV/fCz69v0WlTeSNK1siEa1slBkBsUwn4spzwR3\r\ncRtBeTOVH13HQCKKzPd62xWMtajfs+wE6+NvgWR/5yYxVBmlIq3yOeCNMDMt\r\nGzKz2piJcUJaZ82J9+oYbE0NonudJJuKQhu1FCxJNRBLrShYryXC1TGLSJVX\r\nsJtxNoPpHVHkgrHcL4ZirfAe6zbaN/Vp4vYLgL+tYJt4HKpA/euRYKdlW6ow\r\nCDefAxHk7KGTjInDFSEtfrdc6tjT1eWebvsxJ+qmIHzAGQLLIn/OJNZwFiFQ\r\noDu9m9WTvt6t+i99vEPcohKSmypWx+cSwm5v4DPlVNp6c6USwj/FyySj+Xt4\r\ny+QAI/b4PtW5cMdw6p+PyTLN6rIiBocdNgrrjFvFfuHhTX8JOokgkWn4DWq8\r\nsq2WTqlzK9D6AA9/fp7cqk8xtklPOv2Zkw0Us3yPepCkjTsA33LWNChupSfZ\r\nre2ni82zGTEKh4qSsBzM235zJ9PSxT+O2Kw=\r\n=XTZr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.0-fa578bac_1673459464655_0.6051657087559357"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.14.0-d1c3abb3":{"name":"ipfs-message-port-client","version":"0.14.0-d1c3abb3","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.13.0-d1c3abb3","ipfs-message-port-protocol":"0.14.0-d1c3abb3","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.157.0-d1c3abb3","ipfs-core":"0.17.0-d1c3abb3","ipfs-message-port-server":"0.14.0-d1c3abb3"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"d1c3abb32b57379b5446d5eda232d7750a2ecff0","_id":"ipfs-message-port-client@0.14.0-d1c3abb3","_nodeVersion":"18.12.1","_npmVersion":"8.19.3","dist":{"integrity":"sha512-MtL7B0ns/jdst4wOXPWtYDu1NunuNZp8eselFCnMlPfuFkEZ4pS0qi6ozg1YBKyi3TAN4FVVzD0kQA5Aw4kHkw==","shasum":"7c77fc7729046655bc7fa271576cf97de2c4e1dc","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.14.0-d1c3abb3.tgz","fileCount":37,"unpackedSize":146812,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF299eqwFILFsIubt8zqe9RspEzI5PDsFwVv54R643z8AiBXx1DvKgWSk9f6SXUpMLh/Vlbm5g54hjkB1s1XnkdxNQ=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvvtpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpZJw/8DhNjl3ZNbKKhmgpRrf6vKZPvSAjO9PTR1aJMh9TlV9lL9I7P\r\n8bAWcku9iJgmxjIJ5RC68vHYbxUFvWiPlISCtXCfxidtMVone3jNJkk0GOQA\r\nhdnTkUAI6+8GW8w+dVc7rGr4xErmGNNOxhLvmIJMMejkn05VJNSLGJ/TQcWI\r\nfmlXUF8VMtSgvUeaOTdqW5ugCOVxCPl5eBuTPMCYK/oNb8BntFhOG2yhB3TS\r\nAI5JUreUAFcYqYAmrduLERSMwijJ2CRbzH6axUAwNtMYy99NY9O/jGiM4fXP\r\nihQwXgQF+CwrsrAaDJXTpIOvXaiORtagW08E1fdf3Hs5LXbPqD8wNVhNI+9v\r\nCCN/jNAZ/ORRcF9YIP0RxmLmCULbwdgCA5tLt1KkyQHR2i2QAlaZDQMCs210\r\nkjF6sfy1mnXZLTJoLSkXWh9+emMvVBpVuMESBH5dnonK5/N1YEYZg11401e3\r\nJyjaY6+2bXUSjba4okUiTKXG9hCCWNt/c/A7RHsbSquOlSWQYg+MaRPBITLW\r\nRbpJPK/Lx+XUfkskbFKAPTux6QykALe83OwqT6Q1v9WWsBU+41qE3Q/2PEaJ\r\njEQIwHTaWRxzpAA8Fe2Z6k+2qGe35yUiHkAkmLnNniBjPeoo2ndiKyO8TI45\r\nw8Sn/tG/5fWBP3WUaoHq5/1HCnbYDfmuxPU=\r\n=5lkd\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.14.0-d1c3abb3_1673460585670_0.9108147959301993"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0":{"name":"ipfs-message-port-client","version":"0.15.0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.14.0","ipfs-message-port-protocol":"^0.15.0","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"^0.158.0","ipfs-core":"^0.18.0","ipfs-message-port-server":"^0.15.0"},"gitHead":"6e940670681859682d41ca1339744955c9ee20bf","_id":"ipfs-message-port-client@0.15.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-Hd3DgV4/EzAYekkE5XRmwiJLJeXSRTHUNw6IlA4n2IS2/B7bd7fqW3+69wfrEfj7qhvWAlRPEWl/4rp0Nb1Tkg==","shasum":"18179b3cf500bf55870836d6e8bf86b7f07d85cc","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0.tgz","fileCount":37,"unpackedSize":146763,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDkUfRh6GOvJ1baVhR8GHtPiOSh86JCvv9sZe7GpdOm2QIgd/J7mi4j8RV+zsnSHENOTwRVQsIoFv5hhJXrJkvhWpg="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv/DwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbABAAkUUr6nZM5mEv4sgqi059OEdMzBJLbcExVXkRLrY8+/YMwkas\r\ny0MqGbwytCjlWTNx2qgK+rU2WsgFY99wVd8PAKB2dDRDKwVCFhbTpO3sPIMJ\r\nbjxwILQ6rzKWZcNgbVFTerFoCrT621vKpllOo8ZK8U5+dQVyrOH4D9gLrNv+\r\nP6t6qLFKui3If4qT8cYbegNajJH2V5chQRtxKA7DhalPKTRqnBH+RzBB4haN\r\n7Qov28uPnxwy9JrFV9Fv6fYlzhcjYaGqMt6BtNvpcM9yK5EyGXDf9PffNqos\r\n1+bvVma1G+gnvkrN7jH9WoDkJM5kMlX3aVomT26pV3YSR6UouKYrtLlwOFiK\r\nHgGjRCEqbmHsVVz+wBg6AoUP/nx5fndyUOnTcL13KegGin8D6Gzm1qze9rPx\r\nXSsh+wtLJFV2AvPX/a3NBKafPsEQM140QnIopyj+aX3t68WnjAzq0JD2pjZm\r\ny+nvwXEPfYvGVXINm2hPAC1FqkmZL7jIiegsy63HHalzMm7dhMTkncJozb0U\r\nASEYTmSljeDQGTrz39PgcXLQVuOQJyL7LTU2MpzV1zHbU/+o8jeei7fhhgTO\r\nypUsPFSTDVsfQQn8UpjLHE0ZPn51jYps8oLqzpc3+RKpSMtXzYSK7YDz3LHT\r\n10li48OC/k61ExPZdNOwYnf7z6pohD1sxBk=\r\n=W7Nl\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0_1673523440305_0.0022154068896977908"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-6eeb1be5":{"name":"ipfs-message-port-client","version":"0.15.0-6eeb1be5","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-6eeb1be5","ipfs-message-port-protocol":"0.15.0-6eeb1be5","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-6eeb1be5","ipfs-core":"0.18.0-6eeb1be5","ipfs-message-port-server":"0.15.0-6eeb1be5"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)\n[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)\n[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"6eeb1be57c8366b82351030e49a5886d1aff8bf6","_id":"ipfs-message-port-client@0.15.0-6eeb1be5","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-vvCiNl5Hs+sxxKLHM6Ux8EgXhpOoTYx7xJZO6CrBGRo7rR753AehU4X1iXQ99wpw8dQPqoTD85JQ5efAf3+DCA==","shasum":"3c974eb867e718a90212b155589dda52791733ca","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-6eeb1be5.tgz","fileCount":37,"unpackedSize":146812,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHYIInZWcjJNVjQQ8ZA4kQF7YOrDWAl+mFVYxVgoEk9HAiEApWwJ6EC3xL+nBGBM35GNI+q/0RwxJYzpUtAudza5L3w="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjwaETACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrh4g//UOkRmamS6Bg4MEkAxfXoGwPB5Xuep17U7y0mn4R+a5b4mNGW\r\n/hWL4At3XAwdd9z80ijMHb42kQTZ77j/l6EBII80TXzeeN5jpodzRMllZaBE\r\nayFJbrjkwx7b7p71HQqzCeNCuzmgK0o4SOtJyCaq9Xz5nd0Tr0jdTySOmxQV\r\nko9jsTB8rJvdUuyPlfkFtaHWLjl6P8te9FFi+QfeGwAiVYCPIaEvf5BphJin\r\nm2PVOC2VrE+oNLXvQMlIrBmDT2Flb3RPoxNmqhM/NqWHhaeg+KiFFjyZIaAH\r\nIrF7v9be29SK8NbCkWtQjmsZU0SyvkTugrbGtRMPvAhSWheIG17nKBQbnHzB\r\n5vJ7KJ1bVhCMUXUcxrrxrp8e77o0rtULVjgzh/RXyret7vA7Q14tdHzHBu8O\r\nHTH4qBEEWHHEnksV80mNShq2G4yCdo1sd5uCPCp7Bn0lQlasgyD8bXC94LWA\r\nAelhlQMH9d25h28oOuHiD8MwvhrzlV5JilvxC/8pDT5iQ9DfR7dIaZijxDNW\r\nGkXtuuuUkX/xtHAOJKSpJlQ6zQN2Ca5ZaJvhIyUIKiUoXzQqFSwG8Dy2ab3E\r\nQ3ZA/U3NX6e1hytQKp/HTzKFDG4/PW64EGWnGo9Mt2oL8JsjLv0ZEDIyJ0zf\r\nJHOM8uDYfUq42Wbun85tO2SEXCIvAiZ2m1U=\r\n=3wUy\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-6eeb1be5_1673634067505_0.718726016482762"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-ab02e8f8":{"name":"ipfs-message-port-client","version":"0.15.0-ab02e8f8","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-ab02e8f8","ipfs-message-port-protocol":"0.15.0-ab02e8f8","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-ab02e8f8","ipfs-core":"0.18.0-ab02e8f8","ipfs-message-port-server":"0.15.0-ab02e8f8"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"ab02e8f8b3cf8f4eeb9991fef3b0104728ced675","_id":"ipfs-message-port-client@0.15.0-ab02e8f8","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-nXzN1zj/wyQzlsxB83mf/KFbQYG8Cf2Au2NgjBAaedpTe6YMJ6YBKFB9zw45kynExLM8BY8HdFGTqx4f2okWMQ==","shasum":"61fa7fc18e5fc991441e460d77ca10808c6ea586","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-ab02e8f8.tgz","fileCount":37,"unpackedSize":146741,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEFcd8rzPjDKNOAjcEDQ0J2HPn5D1Z/t+5DhEXBCNyXwIhAJIDBsOZsoZbcT4Dqn7BCcyMLJGQKkai6eCyg1gZPe/g"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxpOSACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrz3A/+OkL5Kvah5WkiJP+HUmsk9QaoGK/750h+iMP6oiV4uWHPNl7R\r\nOewfa7isRCK+NdRmqoD9VxfdV1pq68nhTRZEPlL5yx1zKAiGlZ0vTFcF7l8D\r\nGFCDZppOYqQLj2+UIqlIjnOg7C7sLw/2UOhKNEVfHSxOZvYTub7tymGbbAdN\r\nRSPBmsSZ0LCeQkSWwbuhBRJGDh3eawNk/XlHzuL/+7zcoVX/GwgUJjRLrlR6\r\nb+A/N1fP3zTC4JHcql5+JsLpOIWDWQoaP+yN5CE1IRjXEC3Zm+VaAukSLM4T\r\n6/5R7KZuKlV7K7nhmeOIaxEAoT6Wr23u8KnXz3UuiKfzJ/UtdDNVJe7ErHfE\r\nj+rz9EDeRsUWMpF6MfD50Psvub9dybVgESY6qUyDfvWERhnXF1yJ19f9vE8K\r\n2R3QdYLmYKWX/KtQmEkVjMui/lbvb7gkNTxDAziI0yKb5kS3bT9ppYJdx9CB\r\nclqJzAxBjDYLjxYicG2vSg3NZoqTb7IXe+hv+Zj9yx9lMb6rwGJhQRREtxaQ\r\ne0YLCb7uEuIJE/zwLnp5T5Cs0z0OFDUXCCEWJY2bLMmsPwNNyy81fXUroxQO\r\nWL4pkPpEbkWMp98ONkFGa66JoLJ5JmPu9B53aPVLE7Sz2zDUVb1gmDoK31GV\r\nzYb8u6Nkg7qS0pJ+AnBFQXcmeb0XrnlAV+I=\r\n=euDY\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-ab02e8f8_1673958290650_0.6151600374145534"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-3bcabe38":{"name":"ipfs-message-port-client","version":"0.15.0-3bcabe38","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-3bcabe38","ipfs-message-port-protocol":"0.15.0-3bcabe38","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-3bcabe38","ipfs-core":"0.18.0-3bcabe38","ipfs-message-port-server":"0.15.0-3bcabe38"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"3bcabe3818ce8bbbafe0cbb68749b286d8a7edd9","_id":"ipfs-message-port-client@0.15.0-3bcabe38","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-KQkhSUJmGqfmWsxncni/Su/tBcweOy6ZN6dCucKpSEzsgregO0lxf5vAo67e1AukpsPG+8CLxdyg5Ly1Odl3hg==","shasum":"4b317d6db3819a47a8b933caac98bfced07a9f8c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-3bcabe38.tgz","fileCount":37,"unpackedSize":146711,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCCM9iR/6fClCmS5yjlSKOIzKOli8+WP2CZamlLXvf28wIgKXKesPGAPbfvDY0YqRPPbpWbwwMjf04+juMb6sve4x4="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxr+FACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqpig//Z1IO4NnjnL4RY4BhZ0JUnoC9RslUG8zggp4UVFrgYwbM9uXx\r\nE8wagk5WY6B9F2eGw3zfBsFStGhLWt3Q+iN58KS4afxxBAg5ttjWMVvT+ep3\r\nb4qc/hKhuLP8q16xlOQtoEBRkJfIYDy70Y8qaJ7ujfIG7oWTSJ1vZSniYwKn\r\nuzVl9SxpRerd19MUPacFGIEnuJuQ5YUC7G4ra4SbLm5GGuS0kCdhfrJY6v/O\r\nmCFU+7fXFsi9wc61JS8X3kEV64X2GsGbVrOujEjfuEdsMWM16nhJsCHOnpKT\r\nF3TeieV9t3vsc8JMGGvubTEdult/ASic2/7aoGiBk12QrIgXz3skviV9Gjdo\r\ngzsZxATbZqSivJ3a+YTjB9/D4FSRBnjhT4OjtBS6Axx3dO9eKjXVC8H6hHCc\r\n0Tfk1V8Aove3EgJdig35gq4y3gtAXVVP++Zy7xkwFfED/eJGEv46JIfmJAiY\r\nyuGXqv+wSsHDqvQ3Hu3I2g9ODFvO7WZq7dD5/Gs8mEH/6Zsnjw1DavcACgBC\r\nVQLmrwVjD8Yh22Wam4JB68T4z6CKB87rgxSoTqVjEl9lIxZSemVdCR/Zfjuy\r\nBqJtfMVwzy5oN1IjWR2RjMEOvwhJCRsmpPVHCwoFRXxAx5WjEZzEdYTHBIBa\r\nVh/nMWWEzMPLb7Tk5V5HP6yyHaSfOuvjAOo=\r\n=Zx/7\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-3bcabe38_1673969541106_0.9241398271998076"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-b64d4af0":{"name":"ipfs-message-port-client","version":"0.15.0-b64d4af0","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-b64d4af0","ipfs-message-port-protocol":"0.15.0-b64d4af0","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-b64d4af0","ipfs-core":"0.18.0-b64d4af0","ipfs-message-port-server":"0.15.0-b64d4af0"},"readme":"# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"b64d4af034f27aa7204e57e6a79f95461095502c","_id":"ipfs-message-port-client@0.15.0-b64d4af0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"integrity":"sha512-AFJw8NvYMJ/LMAL2pIl0Ta1LkeBhr+lCepUWnJFDv/7t4FYdYjWMe+0r+jya1xmTFdkT9OEbUFTmJ/Q5iCEfaA==","shasum":"5ded2e1839b87525cffe4031415a1956d116403c","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-b64d4af0.tgz","fileCount":37,"unpackedSize":146810,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCAxT8sr0cUyCTKTgUb3pdHrbuztCLTA5fTG7oLgzYYWAIgAOJYNBgedj7bnlV55+DE2seiMJ6L/vqKVGPuqN1XB+0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj2kwnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqz3g//X8lc7eg3MEMsYb5uLd6+7hMXu0kZva1O92WGskoNVHjKqX57\r\n/dnIJbgWhV85WPWTmDR5l5vvjsxBvIy2/YWPyZR0DUlogXSiYO5JrJ8U5k7X\r\nISFqnkc6aO4/7rfrZVT9sJ5ffLZyW1+U5W7adBALvrEex989X/rASaJc/nbE\r\nh5xsH7JCBUX7O17LNKPlOsxYFbm1A2zvAvIBr24byv/2CBTGamJ0kT/T+N6J\r\n3fxEQBhrksMd4GxPMIJPhPTBUU28OgC0LQ8bVCtDkx/1X3awsz1sk4VH7hd8\r\nX+LElVR4+757Ne5k/kzEAZv7hXqv7Irc+MWZAJkBG/URoURwPkGUn9KeRKi2\r\n2vHLCa7YbDYF80oqZqkFtuOcJOpzH+4NMeYby4ScCzrtdmhx4CDiLtYrPLkv\r\nc/2dWVQZcx5w6501TqaOrquqhIKbK8ts/QMr7k9/RXmv4sKwmpaxw80xDh94\r\nk6Ecqb25Ly/P2ERmD7Jh9+pvfm9F4VMYC0mXBRWZ3Wbpt+QHGOs26xVukMXB\r\npn04ZN31ZJwfmh+/Gz8vTMMV8IX4MgnWaJJ8kk2GS7fRvf0CWEHTFGzqhA5z\r\n6gp6Xe5yCqAiIyYNBXb66COZpsfdNvu4WYXHEpxZqmLqaTFXXNhY5MTLFNiz\r\nGEuU9dKqZ5mZUr2EfqYCt4g5SY2YlbuHI/4=\r\n=tofH\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-b64d4af0_1675250727289_0.07195429549527232"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-e64813f6":{"name":"ipfs-message-port-client","version":"0.15.0-e64813f6","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-e64813f6","ipfs-message-port-protocol":"0.15.0-e64813f6","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-e64813f6","ipfs-core":"0.18.0-e64813f6","ipfs-message-port-server":"0.15.0-e64813f6"},"readme":"> # ⛔️ DEPRECATED: [js-IPFS](https://github.com/ipfs/js-ipfs) has been superseded by [Helia](https://github.com/ipfs/helia)\n>\n> 📚 [Learn more about this deprecation](https://github.com/ipfs/js-ipfs/issues/4336) or [how to migrate](https://github.com/ipfs/helia/wiki/Migrating-from-js-IPFS)\n>\n> ⚠️ If you continue using this repo, please note that security fixes will not be provided\n\n# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"e64813f6fdc681328da7cb893c93e1f4f70bfc99","_id":"ipfs-message-port-client@0.15.0-e64813f6","_nodeVersion":"18.16.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-psZVrX27/x+5N0JFlKIfmmRILVopxe9Kv8PHXveRWUW+/b3Bwt4ixVsURwoDfuALmaqjKz9GxULL+idLptMPSg==","shasum":"037e1808b76c4973b0df7a0fefa475a7e6cec6d4","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-e64813f6.tgz","fileCount":37,"unpackedSize":147223,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIARg2lK5KKj8vVzrqUr1Y0B2ao/RzFprhPubfRtIQBBHAiBxa8bCEIV+oxP+2eNedQS3yoyCZ77ldJve892fHGsVQw=="}]},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-e64813f6_1684953989013_0.3455268485644698"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-4694e806":{"name":"ipfs-message-port-client","version":"0.15.0-4694e806","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-4694e806","ipfs-message-port-protocol":"0.15.0-4694e806","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-4694e806","ipfs-core":"0.18.0-4694e806","ipfs-message-port-server":"0.15.0-4694e806"},"readme":"> # ⛔️ DEPRECATED: [js-IPFS](https://github.com/ipfs/js-ipfs) has been superseded by [Helia](https://github.com/ipfs/helia)\n>\n> 📚 [Learn more about this deprecation](https://github.com/ipfs/js-ipfs/issues/4336) or [how to migrate](https://github.com/ipfs/helia/wiki/Migrating-from-js-IPFS)\n>\n> ⚠️ If you continue using this repo, please note that security fixes will not be provided\n\n# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"4694e806aea15c66db32e3b4be81c0a5e2fb8ade","_id":"ipfs-message-port-client@0.15.0-4694e806","_nodeVersion":"18.16.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-6/6xpcdtVe1nLWF8QteejdAVUoQckaHyV7XKG2GQpGlBa0VKveh3Uh9F/Z9130xr4Dwvggv3zNv9JMxPPTq9rg==","shasum":"0ab0e788f8f19cb0c93f467e1fe599bda3a2c6f9","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-4694e806.tgz","fileCount":37,"unpackedSize":147223,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGVQV56uZYEtLBuPg9WbeOaVZPz4h9lk2WNVburQlsIWAiBupaemAVQiSi4akdALZM8SP06gEytTBeh8xKA0THDOkQ=="}]},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-4694e806_1685014345230_0.840363991564262"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-6d95ce08":{"name":"ipfs-message-port-client","version":"0.15.0-6d95ce08","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-6d95ce08","ipfs-message-port-protocol":"0.15.0-6d95ce08","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-6d95ce08","ipfs-core":"0.18.0-6d95ce08","ipfs-message-port-server":"0.15.0-6d95ce08"},"readme":"> # ⛔️ DEPRECATED: [js-IPFS](https://github.com/ipfs/js-ipfs) has been superseded by [Helia](https://github.com/ipfs/helia)\n>\n> 📚 [Learn more about this deprecation](https://github.com/ipfs/js-ipfs/issues/4336) or [how to migrate](https://github.com/ipfs/helia/wiki/Migrating-from-js-IPFS)\n>\n> ⚠️ If you continue using this repo, please note that security fixes will not be provided\n\n# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"6d95ce0864055e5236ac88c0999460ebc5075c10","_id":"ipfs-message-port-client@0.15.0-6d95ce08","_nodeVersion":"18.16.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-vSQvuDaB1a0mslhvnMO+eWeQz47bogwJeBM3cNUEOSckVeSDcF9IUTqdLjgjVryr40zxWuDCoidZw6IHYx2Xkw==","shasum":"16cac158df91e3a1de7998b1728f297db73f62e1","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-6d95ce08.tgz","fileCount":37,"unpackedSize":147223,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICcEatsnQ8MlK37zC8D9FRbPPcYs3YOR5JxlUGbgIsE6AiEAo2q+iGBIrpdrEarWbrAN61JwTSPEJVM96nQ5zS+nFMI="}]},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-6d95ce08_1685016681091_0.94330289936737"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.0-7b79c1b8":{"name":"ipfs-message-port-client","version":"0.15.0-7b79c1b8","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"0.14.0-7b79c1b8","ipfs-message-port-protocol":"0.15.0-7b79c1b8","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"0.158.0-7b79c1b8","ipfs-core":"0.18.0-7b79c1b8","ipfs-message-port-server":"0.15.0-7b79c1b8"},"readme":"> # ⛔️ DEPRECATED: [js-IPFS](https://github.com/ipfs/js-ipfs) has been superseded by [Helia](https://github.com/ipfs/helia)\n>\n> 📚 [Learn more about this deprecation](https://github.com/ipfs/js-ipfs/issues/4336) or [how to migrate](https://github.com/ipfs/helia/wiki/Migrating-from-js-IPFS)\n>\n> ⚠️ If you continue using this repo, please note that security fixes will not be provided\n\n# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md","gitHead":"7b79c1b8df5c818dc124b346ea28330455732d5c","_id":"ipfs-message-port-client@0.15.0-7b79c1b8","_nodeVersion":"18.16.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-C6zw8z6tjnjLA25eXEI3KibaukgcZfOW6x+XkOnmdHeWoyLM4cTrm4IVrX53qsTlQQQyv2ZMI1lAATrC5z6LPw==","shasum":"661e9f5e556605be4f1c282006aae5542e93f032","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.0-7b79c1b8.tgz","fileCount":37,"unpackedSize":147223,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHCpwcgdExUffvp+W3kpU6sWIUFZRVC7V9guYf7ThPV3AiEAjWrLyMlEYT5zHnkay7QmQOfWJZ0YKnXsh3neoyKJQr0="}]},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.0-7b79c1b8_1685018824059_0.046438340110072085"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"},"0.15.1":{"name":"ipfs-message-port-client","version":"0.15.1","description":"IPFS client library for accessing IPFS node over message port","license":"Apache-2.0 OR MIT","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"keywords":["ipfs","message-port","worker"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","typesVersions":{"*":{"*":["*","dist/*","dist/src/*","dist/src/*/index"],"src/*":["*","dist/*","dist/src/*","dist/src/*/index"]}},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"build":"aegir build","test:interface:message-port-client":"aegir test -t browser --bail -f ./test/interface-message-port-client.js","lint":"aegir lint","clean":"aegir clean","dep-check":"aegir dep-check -i ipfs-core -i ipfs-core-types -i esbuild"},"dependencies":{"browser-readablestream-to-it":"^2.0.0","err-code":"^3.0.1","ipfs-core-types":"^0.14.1","ipfs-message-port-protocol":"^0.15.1","ipfs-unixfs":"^9.0.0","it-peekable":"^2.0.0","multiformats":"^11.0.0"},"devDependencies":{"aegir":"^37.11.0","interface-ipfs-core":"^0.158.1","ipfs-core":"^0.18.1","ipfs-message-port-server":"^0.15.1"},"gitHead":"bf1bc8b18d750d5591bdd575a6d0f4c067d61d0a","_id":"ipfs-message-port-client@0.15.1","_nodeVersion":"18.16.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-dOPtzpGseHeuhLKNzBjGNvMizAUALdZJ+jl7BEcJsETJ5aXvGyX8iczp7hrUkPSCRA1hx/wnvuveiwXUtX5YOg==","shasum":"48a083a67c57d156a38cd10eddce8df636deb144","tarball":"https://registry.npmjs.org/ipfs-message-port-client/-/ipfs-message-port-client-0.15.1.tgz","fileCount":37,"unpackedSize":147174,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfCIjnc/+XzCos2e5kxuE/dVANASF1UOJ0w4FYnqrXlQIgXgvK2DE+n+1UhDcSpWuJKJpFvoIb5//tUA8svomARfE="}]},"_npmUser":{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"},"directories":{},"maintainers":[{"name":"gozala","email":"dev@gozala.io"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"ipfs-npm-publisher-bot","email":"alex.potsides+ipfs-npm-publisher-bot@protocol.ai"},{"name":"npm-service-account-ipfs","email":"npm-service-account+ipfs@protocol.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ipfs-message-port-client_0.15.1_1685026829810_0.4993104430128008"},"_hasShrinkwrap":false,"deprecated":"js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details"}},"time":{"created":"2020-07-15T20:11:28.928Z","0.0.0-dev":"2020-07-15T20:11:29.122Z","modified":"2023-06-01T16:27:09.753Z","0.1.0":"2020-08-12T10:50:33.034Z","0.1.1-rc.2":"2020-08-18T16:00:47.722Z","0.1.1":"2020-08-24T16:58:14.540Z","0.1.2-rc.0":"2020-08-25T07:12:17.373Z","0.1.2-rc.4":"2020-08-27T17:08:25.226Z","0.1.2-rc.3":"2020-08-27T17:28:02.098Z","0.1.2-rc.5":"2020-09-02T11:11:37.620Z","0.1.2-rc.12":"2020-09-03T12:59:21.894Z","0.2.0":"2020-09-03T14:18:34.381Z","0.2.1-rc.25":"2020-09-04T14:27:24.663Z","0.2.1":"2020-09-04T15:04:19.488Z","0.2.2-rc.2":"2020-09-09T11:49:48.433Z","0.2.2":"2020-09-09T14:26:32.842Z","0.2.3-rc.1":"2020-09-10T08:16:05.007Z","0.2.3-rc.2":"2020-09-11T15:12:03.270Z","0.2.3-rc.3":"2020-09-14T13:08:45.344Z","0.2.3-rc.4":"2020-09-25T13:48:45.086Z","0.2.3-rc.6":"2020-10-05T22:17:21.485Z","0.2.3-rc.7":"2020-10-06T03:02:41.938Z","0.2.3-rc.9":"2020-10-06T10:47:29.295Z","0.2.3-rc.10":"2020-10-06T12:43:05.493Z","0.2.3-rc.11":"2020-10-10T08:14:46.105Z","0.2.3-rc.12":"2020-10-10T10:13:05.941Z","0.2.3-rc.14":"2020-10-15T15:45:29.393Z","0.2.3-rc.15":"2020-10-15T16:03:47.401Z","0.2.3-rc.16":"2020-10-21T16:46:17.693Z","0.2.3-rc.22":"2020-10-22T14:04:58.552Z","0.2.3-rc.24":"2020-10-23T11:32:52.650Z","0.2.3-rc.25":"2020-10-27T07:53:41.414Z","0.2.3-rc.26":"2020-10-27T09:23:57.355Z","0.2.3-rc.28":"2020-10-27T13:16:30.603Z","0.2.3-rc.29":"2020-10-27T15:10:46.573Z","0.2.3-rc.31":"2020-10-28T14:35:02.949Z","0.3.0":"2020-10-28T15:52:03.983Z","0.3.1-rc.2":"2020-10-28T17:07:35.448Z","0.3.1-rc.4":"2020-10-30T11:31:13.547Z","0.3.1-rc.5":"2020-10-30T15:35:50.410Z","0.3.1-rc.6":"2020-10-30T16:53:46.474Z","0.3.1-rc.8":"2020-11-02T13:52:44.480Z","0.3.1-rc.10":"2020-11-06T18:26:39.374Z","0.3.1-rc.12":"2020-11-09T16:12:20.081Z","0.3.1-rc.13":"2020-11-09T16:54:48.340Z","0.4.0":"2020-11-09T17:09:23.795Z","0.4.1-rc.1":"2020-11-10T09:13:26.846Z","0.4.1-rc.3":"2020-11-12T12:37:37.603Z","0.4.1-rc.5":"2020-11-13T09:22:05.783Z","0.4.1-rc.7":"2020-11-16T09:39:31.998Z","0.4.1-rc.8":"2020-11-16T10:37:59.727Z","0.4.1":"2020-11-16T11:28:39.807Z","0.4.2-rc.2":"2020-11-16T13:20:50.041Z","0.4.2-rc.3":"2020-11-18T12:52:43.903Z","0.4.2-rc.6":"2020-11-20T23:37:37.350Z","0.4.2-rc.8":"2020-11-25T07:55:11.565Z","0.4.2":"2020-11-25T08:37:39.046Z","0.4.3-rc.1":"2020-11-26T08:24:27.065Z","0.4.3-rc.2":"2020-11-26T08:34:56.622Z","0.4.3-rc.3":"2020-11-26T15:32:29.016Z","0.4.3-rc.4":"2020-11-26T18:44:21.770Z","0.4.3-rc.7":"2020-12-03T17:03:58.312Z","0.4.3-rc.8":"2020-12-03T17:30:42.777Z","0.4.3-rc.11":"2020-12-05T08:28:16.583Z","0.4.3-rc.13":"2020-12-14T14:30:26.985Z","0.4.3":"2020-12-16T10:27:20.097Z","0.4.4-rc.1":"2020-12-18T14:43:07.282Z","0.4.4-rc.4":"2020-12-18T17:46:53.411Z","0.4.4-rc.5":"2021-01-13T12:26:13.638Z","0.4.4-rc.6":"2021-01-15T08:51:17.524Z","0.4.4":"2021-01-15T11:42:54.120Z","0.4.5":"2021-01-20T07:49:41.050Z","0.4.6":"2021-01-22T12:04:13.657Z","0.4.7-rc.3":"2021-01-30T08:09:06.939Z","0.5.0":"2021-02-01T12:34:12.786Z","0.5.1":"2021-02-02T09:14:53.738Z","0.5.2":"2021-02-08T16:03:15.357Z","0.5.3-rc.4":"2021-02-21T09:16:33.984Z","0.5.3-rc.5":"2021-02-22T16:41:47.682Z","0.5.3":"2021-03-09T10:47:27.013Z","0.5.4":"2021-03-10T11:13:11.924Z","0.5.5-rc.3":"2021-03-31T15:16:27.162Z","0.5.5-rc.11":"2021-04-28T12:16:32.957Z","0.5.5-rc.14":"2021-04-28T17:13:09.987Z","0.5.5-rc.17":"2021-04-29T16:56:45.451Z","0.5.5-rc.18":"2021-04-30T09:24:46.354Z","0.5.5-rc.19":"2021-04-30T17:05:05.044Z","0.5.5-rc.20":"2021-05-01T17:53:05.787Z","0.5.5-rc.21":"2021-05-02T09:00:46.396Z","0.5.5-rc.22":"2021-05-04T07:45:21.203Z","0.5.5-rc.24":"2021-05-04T10:57:11.053Z","0.5.5-rc.25":"2021-05-04T11:19:28.812Z","0.5.5-rc.26":"2021-05-04T13:56:02.706Z","0.5.5-rc.27":"2021-05-06T11:43:14.341Z","0.5.5-rc.28":"2021-05-06T14:17:59.501Z","0.5.5-rc.29":"2021-05-07T11:59:27.567Z","0.5.5-rc.30":"2021-05-07T13:39:59.851Z","0.5.5":"2021-05-07T15:45:37.038Z","0.5.5-rc.31":"2021-05-10T11:57:58.194Z","0.5.5-rc.32":"2021-05-10T12:21:20.681Z","0.6.0":"2021-05-10T14:53:09.315Z","0.6.1-rc.1":"2021-05-11T06:09:57.240Z","0.6.1":"2021-05-11T18:22:13.251Z","0.6.2-rc.1":"2021-05-11T20:27:32.128Z","0.6.2-rc.2":"2021-05-13T18:07:03.860Z","0.6.2-rc.3":"2021-05-25T14:40:26.137Z","0.6.2-rc.7":"2021-05-25T16:06:39.674Z","0.6.2":"2021-05-26T09:33:04.784Z","0.6.3-rc.1":"2021-05-26T12:25:15.176Z","0.6.3-rc.3":"2021-06-01T20:39:30.775Z","0.6.3-rc.4":"2021-06-05T06:17:34.188Z","0.6.3":"2021-06-05T06:32:55.791Z","0.6.4-rc.1":"2021-06-10T09:26:53.782Z","0.6.4-rc.2":"2021-06-15T16:49:18.965Z","0.6.4-rc.3":"2021-06-18T08:11:37.278Z","0.6.4-rc.4":"2021-06-18T09:21:18.363Z","0.6.4":"2021-06-18T11:16:02.861Z","0.6.5-rc.1":"2021-06-18T15:58:17.903Z","0.6.5-rc.2":"2021-06-25T15:14:07.744Z","0.6.5-rc.3":"2021-07-01T16:06:02.330Z","0.6.5-rc.6":"2021-07-19T15:31:44.072Z","0.6.5-rc.8":"2021-07-27T09:29:14.932Z","0.6.5-rc.9":"2021-07-27T10:01:28.885Z","0.6.5-rc.11":"2021-07-27T10:39:08.382Z","0.6.5-rc.14":"2021-07-27T12:20:23.689Z","0.6.5-rc.17":"2021-07-27T14:23:56.761Z","0.7.0":"2021-07-27T15:07:59.920Z","0.7.1-rc.1":"2021-07-28T11:30:23.210Z","0.7.1-rc.2":"2021-07-28T12:25:42.297Z","0.7.1-rc.5":"2021-07-28T16:56:54.474Z","0.7.1":"2021-07-30T17:08:32.760Z","0.7.1-rc.7":"2021-07-30T17:31:07.598Z","0.7.2-rc.1":"2021-07-30T18:57:28.991Z","0.7.2-rc.2":"2021-08-04T13:52:59.105Z","0.7.2-rc.3":"2021-08-05T11:48:24.685Z","0.7.2-rc.6":"2021-08-09T16:32:39.264Z","0.7.2-rc.8":"2021-08-10T07:19:37.380Z","0.7.2-rc.10":"2021-08-10T09:10:01.401Z","0.7.2-rc.11":"2021-08-11T09:22:58.295Z","0.8.0":"2021-08-11T15:11:52.362Z","0.8.1-rc.4":"2021-08-12T10:51:13.397Z","0.8.1-rc.5":"2021-08-12T11:07:24.821Z","0.8.1-rc.6":"2021-08-12T14:11:01.978Z","0.8.1-rc.7":"2021-08-16T15:47:29.179Z","0.8.1":"2021-08-17T10:42:35.394Z","0.8.1-rc.9":"2021-08-17T10:52:21.977Z","0.8.1-rc.10":"2021-08-17T11:09:47.754Z","0.8.2-rc.1":"2021-08-17T12:56:12.469Z","0.7.2":"2021-08-17T14:10:06.223Z","0.8.2":"2021-08-17T17:18:06.441Z","0.8.3":"2021-08-17T19:58:38.000Z","0.8.4-rc.1":"2021-08-17T21:56:08.210Z","0.8.4-rc.3":"2021-08-25T07:32:41.466Z","0.8.4-rc.4":"2021-08-25T08:53:09.723Z","0.8.4":"2021-08-25T15:56:17.575Z","0.8.5-rc.2":"2021-08-26T09:48:29.354Z","0.8.5-rc.3":"2021-08-26T11:10:17.943Z","0.8.5-rc.4":"2021-08-26T13:58:29.727Z","0.8.5-rc.5":"2021-08-26T15:43:23.860Z","0.8.5-rc.6":"2021-08-31T13:35:09.983Z","0.8.5-rc.7":"2021-09-02T15:00:08.563Z","0.8.5-rc.8":"2021-09-02T17:39:09.230Z","0.8.5":"2021-09-02T18:19:09.730Z","0.8.6-rc.1":"2021-09-06T11:19:11.061Z","0.8.6-rc.2":"2021-09-06T15:02:17.711Z","0.8.6-rc.4":"2021-09-07T17:03:58.090Z","0.8.6-rc.5":"2021-09-08T09:33:35.644Z","0.8.6":"2021-09-08T10:02:10.411Z","0.8.7-rc.1":"2021-09-14T13:40:27.422Z","0.8.7-rc.4":"2021-09-17T12:50:57.069Z","0.8.7":"2021-09-17T13:24:07.899Z","0.8.8-rc.0":"2021-09-17T13:30:17.974Z","0.8.9-rc.0":"2021-09-17T16:25:36.894Z","0.8.8":"2021-09-17T16:36:07.205Z","0.8.9-rc.1":"2021-09-21T16:10:50.898Z","0.8.9-rc.12":"2021-09-23T06:16:21.568Z","0.8.9-rc.14":"2021-09-23T10:47:56.924Z","0.8.9-rc.15":"2021-09-23T12:56:54.290Z","0.8.9-rc.16":"2021-09-23T18:33:17.050Z","0.8.9-rc.17":"2021-09-24T11:20:48.583Z","0.8.9-rc.18":"2021-09-24T12:45:37.703Z","0.9.0":"2021-09-24T12:49:24.708Z","0.9.1-rc.0":"2021-09-24T12:53:40.725Z","0.9.1-rc.1":"2021-09-25T17:26:15.841Z","0.9.1-rc.2":"2021-09-25T18:11:11.982Z","0.9.1-rc.3":"2021-09-27T16:37:32.083Z","0.9.1-rc.5":"2021-09-28T12:00:15.726Z","0.9.1":"2021-09-28T12:03:06.293Z","0.9.2-rc.0":"2021-09-28T12:07:42.321Z","0.9.2-rc.1":"2021-09-30T15:48:54.516Z","0.9.2-rc.2":"2021-09-30T17:39:14.669Z","0.9.2-rc.3":"2021-10-02T12:58:16.799Z","0.9.2-rc.4":"2021-10-08T14:33:03.437Z","0.9.2-rc.5":"2021-11-04T07:26:19.905Z","0.9.2-rc.6":"2021-11-12T11:31:14.814Z","0.10.0":"2021-11-12T11:54:28.730Z","0.10.1-rc.0":"2021-11-12T11:56:09.081Z","0.10.1-rc.1":"2021-11-19T15:42:16.672Z","0.10.1":"2021-11-19T15:46:15.674Z","0.10.2-rc.0":"2021-11-19T15:48:36.440Z","0.10.2-rc.1":"2021-11-19T17:23:38.434Z","0.10.2-rc.2":"2021-11-22T16:17:27.938Z","0.10.2-rc.3":"2021-11-24T09:35:52.179Z","0.10.2":"2021-11-24T09:38:01.140Z","0.10.3-rc.0":"2021-11-24T09:39:42.187Z","0.10.3-rc.1":"2021-12-03T10:52:03.495Z","0.10.3-rc.2":"2021-12-03T13:26:30.567Z","0.10.3-rc.3":"2021-12-03T14:05:37.147Z","0.10.3-rc.4":"2021-12-03T15:01:43.612Z","0.10.3-rc.5":"2021-12-06T10:37:54.071Z","0.10.3-rc.6":"2021-12-06T16:29:02.130Z","0.10.3-rc.7":"2021-12-06T22:23:45.279Z","0.10.3-rc.8":"2021-12-13T11:34:40.570Z","0.10.3-rc.9":"2021-12-13T12:09:44.667Z","0.10.3-rc.11":"2021-12-15T12:50:34.335Z","0.10.3-rc.10":"2021-12-15T12:50:45.693Z","0.10.3-rc.12":"2021-12-15T12:53:08.165Z","0.10.3-rc.13":"2021-12-15T18:25:16.366Z","0.10.3":"2021-12-15T20:27:38.942Z","0.10.4-rc.0":"2021-12-15T20:29:55.248Z","0.10.4-rc.1":"2021-12-16T09:06:56.932Z","0.10.4-rc.2":"2021-12-17T09:57:17.492Z","0.10.4-rc.3":"2022-01-13T18:31:20.619Z","0.10.4-rc.4":"2022-01-20T14:26:37.832Z","0.10.4-rc.5":"2022-01-21T15:46:14.543Z","0.10.4-7fe0da57f.0":"2022-01-26T12:13:57.463Z","0.10.4-5439a0e.0":"2022-01-26T13:07:36.890Z","0.10.4-a6b201af.0":"2022-01-27T15:37:28.247Z","0.10.4-fbe14923.0":"2022-01-27T18:17:32.484Z","0.10.4-6cb3a87e.0":"2022-01-27T19:12:46.489Z","0.11.1-2afef2eb.0":"2022-01-27T20:09:01.304Z","0.11.1-3a5d61d4.0":"2022-01-27T21:33:43.679Z","0.10.4-cca6e321.0":"2022-01-27T23:03:49.657Z","0.11.0":"2022-01-27T23:17:54.800Z","0.11.1-8d260215.0":"2022-01-27T23:53:03.661Z","0.11.1-2c8ec080.0":"2022-01-28T14:56:27.199Z","0.11.1-3a74c110.0":"2022-02-04T16:17:07.839Z","0.11.1-383dc07d.0":"2022-02-04T19:57:14.017Z","0.11.1-709831f6.0":"2022-02-06T16:03:27.601Z","0.11.1":"2022-02-07T16:51:33.635Z","0.11.2-1082fce9.0":"2022-02-18T16:15:01.175Z","0.11.2-125d42ba.0":"2022-03-01T09:46:58.160Z","0.11.2-df1bd1bb.0":"2022-03-01T11:11:13.384Z","0.11.2":"2022-04-05T15:10:19.023Z","0.11.3-e90b8f13.0":"2022-04-05T16:10:08.734Z","0.11.3-8f7ce23c.0":"2022-04-20T12:40:15.075Z","0.11.3":"2022-04-26T07:02:09.605Z","0.11.4-7165bf71.0":"2022-05-16T20:07:55.950Z","0.11.4-4e93dd5d.0":"2022-05-27T13:43:10.864Z","0.11.4-919b27a8.0":"2022-05-27T16:18:37.010Z","0.12.0":"2022-05-30T19:17:23.006Z","0.12.1-ddfb899f.0":"2022-05-30T19:57:00.219Z","0.12.1-764b4adc.0":"2022-06-01T14:26:25.468Z","0.12.1-be025c89.0":"2022-06-01T14:31:34.485Z","0.12.1-87e00a69.0":"2022-06-01T14:36:15.875Z","0.12.1":"2022-06-01T15:16:28.820Z","0.12.2-70e142ac.0":"2022-06-13T16:00:34.596Z","0.12.2":"2022-06-14T06:25:26.062Z","0.12.3-7be50bd1.0":"2022-06-22T17:48:37.415Z","0.12.3":"2022-06-23T12:03:17.280Z","0.12.4-00bd3dd0.0":"2022-06-24T09:30:50.205Z","0.12.4":"2022-06-24T10:25:28.916Z","0.12.5-a05695fc.0":"2022-07-20T13:22:20.707Z","0.12.5-39dbf708.0":"2022-08-17T21:43:05.505Z","0.12.5-8f351a89.0":"2022-08-17T23:18:58.079Z","0.12.5-83f9882e.0":"2022-09-06T11:30:41.638Z","0.12.5-051da161.0":"2022-09-07T12:55:41.058Z","0.13.0":"2022-09-07T13:38:05.302Z","0.13.1-b5456882.0":"2022-09-16T09:24:22.987Z","0.13.1-7c676f63.0":"2022-09-21T19:16:32.116Z","0.13.1-2a830bf5.0":"2022-09-21T20:54:10.257Z","0.13.1-7304a0f4.0":"2022-09-21T20:54:51.837Z","0.13.1":"2022-09-21T21:55:04.387Z","0.13.2-d75e0a39.0":"2022-09-22T08:52:17.468Z","0.13.2-d1b0a8a7.0":"2022-09-22T10:41:57.511Z","0.13.2-acbc1c62.0":"2022-09-22T12:59:58.745Z","0.13.2-dfc43d4e.0":"2022-09-26T14:20:27.691Z","0.13.2-0cee4a4c.0":"2022-10-24T09:13:33.450Z","0.14.0":"2022-10-24T10:47:34.489Z","0.14.1-a77e40cc.0":"2022-10-25T07:11:33.866Z","0.14.1-58e6f468.0":"2022-10-25T08:15:48.952Z","0.14.1-6ae5eb7d.0":"2022-10-28T07:29:55.777Z","0.14.1-6be59068.0":"2022-11-17T19:48:05.991Z","0.0.1-563806f1.0":"2023-01-09T18:11:18.808Z","0.0.1-e85e5b6e.0":"2023-01-09T19:16:15.829Z","0.0.1-2a6fede5.0":"2023-01-10T09:36:01.385Z","0.14.0-5f73ecad":"2023-01-10T17:15:14.525Z","0.14.0-4b4c124c":"2023-01-11T16:06:41.323Z","0.14.0-789ee585":"2023-01-11T17:06:11.582Z","0.14.0-fa578bac":"2023-01-11T17:51:04.874Z","0.14.0-d1c3abb3":"2023-01-11T18:09:45.863Z","0.15.0":"2023-01-12T11:37:20.481Z","0.15.0-6eeb1be5":"2023-01-13T18:21:07.758Z","0.15.0-ab02e8f8":"2023-01-17T12:24:50.833Z","0.15.0-3bcabe38":"2023-01-17T15:32:21.337Z","0.15.0-b64d4af0":"2023-02-01T11:25:27.478Z","0.15.0-e64813f6":"2023-05-24T18:46:29.264Z","0.15.0-4694e806":"2023-05-25T11:32:25.518Z","0.15.0-6d95ce08":"2023-05-25T12:11:21.255Z","0.15.0-7b79c1b8":"2023-05-25T12:47:04.296Z","0.15.1":"2023-05-25T15:00:30.083Z"},"maintainers":[{"email":"alex@achingbrain.net","name":"achingbrain"},{"email":"npm-service-account+ipfs@protocol.ai","name":"npm-service-account-ipfs"}],"description":"IPFS client library for accessing IPFS node over message port","homepage":"https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-message-port-client#readme","keywords":["ipfs","message-port","worker"],"repository":{"type":"git","url":"git+https://github.com/ipfs/js-ipfs.git"},"bugs":{"url":"https://github.com/ipfs/js-ipfs/issues"},"license":"Apache-2.0 OR MIT","readme":"> # ⛔️ DEPRECATED: [js-IPFS](https://github.com/ipfs/js-ipfs) has been superseded by [Helia](https://github.com/ipfs/helia)\n>\n> 📚 [Learn more about this deprecation](https://github.com/ipfs/js-ipfs/issues/4336) or [how to migrate](https://github.com/ipfs/helia/wiki/Migrating-from-js-IPFS)\n>\n> ⚠️ If you continue using this repo, please note that security fixes will not be provided\n\n# ipfs-message-port-client <!-- omit in toc -->\n\n[![ipfs.tech](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](https://ipfs.tech)\n[![Discuss](https://img.shields.io/discourse/https/discuss.ipfs.tech/posts.svg?style=flat-square)](https://discuss.ipfs.tech)\n[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs)\n[![CI](https://img.shields.io/github/actions/workflow/status/ipfs/js-ipfs/test.yml?branch=master\\&style=flat-square)](https://github.com/ipfs/js-ipfs/actions/workflows/test.yml?query=branch%3Amaster)\n\n> IPFS client library for accessing IPFS node over message port\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n  - [Notes on Performance](#notes-on-performance)\n- [License](#license)\n- [Contribute](#contribute)\n\n## Install\n\n```console\n$ npm i ipfs-message-port-client\n```\n\n## Usage\n\nThis client library works with IPFS node over the [message channel][] and assumes that IPFS node is provided via `ipfs-message-port-server` on the other end.\n\nIt provides following API subset:\n\n- [`ipfs.dag`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/DAG.md)\n- [`ipfs.block`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/BLOCK.md)\n- [`ipfs.add`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsadddata-options)\n- [`ipfs.addAll`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsaddallsource-options)\n- [`ipfs.cat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfscatipfspath-options)\n- [`ipfs.files.stat`](https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilesstatpath-options)\n\nA client can be instantiated from the [`MessagePort`][] instance. The primary\ngoal of this library is to allow sharing a node across browsing contexts (tabs,\niframes) and therefore most likely `ipfs-message-port-server` will be in a\nseparate JS bundle and loaded in the [SharedWorker][].\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n// URL to the script containing ipfs-message-port-server.\nconst IPFS_SERVER_URL = '/bundle/ipfs-worker.js'\n\nconst main = async () => {\n  const worker = new SharedWorker(IPFS_SERVER_URL)\n  const ipfs = IPFSClient.from(worker.port)\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n```\n\nIt is also possible to instantiate a detached client, which can be attached to\nthe server later on. This is useful when a server port is received via a message\nfrom another JS context (e.g. iframe)\n\n> Note: Client will queue all API calls and only execute them once it is\n> attached (unless they time out or are aborted in the meantime).\n\n```js\nimport { IPFSClient } from 'ipfs-message-port-client'\n\nconst ipfs = IPFSClient.detached()\n\nconst main = async () => {\n  const data = ipfs.cat('/ipfs/QmdfTbBqBPQ7VNxZEYEj14VmRuZBkqFbiwReogJgS1zR1n')\n\n  for await (const chunk of data) {\n    console.log(chunk)\n  }\n}\n\nwindow.onload = main\nwindow.onmessage = ({ports}) => {\n  IPFSClient.attach(ports[0])\n}\n```\n\n### Notes on Performance\n\nSince client works with IPFS node over [message channel][] all the data passed\nis copied via [structured cloning algorithm][], which may lead to suboptimal\nresults (especially with large binary data). In order to avoid unnecessary\ncopying all API options have being extended with optional `transfer` property\nthat can be supplied [Transferable][]s which will be used to move corresponding\nvalues instead of copying.\n\n> **Note:** Transferring data will empty it on the sender side which can lead to\n> errors if that data is used again later. To avoid these errors transfer option\n> was added so user can explicitly give up reference when it is safe to do so.\n\n```js\n/**\n * @param {Uint8Array} data - Large data chunk\n */\nconst example = async (data) => {\n  // Passing `data.buffer` will cause underlying `ArrayBuffer` to be\n  // transferred emptying `data` in JS context.\n  ipfs.add(data, { transfer: [data.buffer] })\n}\n```\n\nIt is however recommended to prefer web native [Blob][] / [File][] instances as\nmost web APIs provide them as option & can be send across without copying\nunderlying memory.\n\n```js\nconst example = async (url) => {\n  const request = await fetch(url)\n  const blob = await request.blob()\n  ipfs.add(blob)\n}\n```\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribute\n\nContributions welcome! Please check out [the issues](https://github.com/ipfs/js-ipfs/issues).\n\nAlso see our [contributing document](https://github.com/ipfs/community/blob/master/CONTRIBUTING_JS.md) for more information on how we work, and about contributing in general.\n\nPlease be aware that all interactions related to this repo are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)\n\n[message channel]: https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel\n\n[SharedWorker]: https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker\n\n[`MessagePort`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort\n\n[structured cloning algorithm]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\n\n[Transferable]: https://developer.mozilla.org/en-US/docs/Web/API/Transferable\n\n[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob\n\n[File]: https://developer.mozilla.org/en-US/docs/Web/API/File\n","readmeFilename":"README.md"}