
Security News
CISA Kills Off RSS Feeds for KEVs and Cyber Alerts
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
ipfs-message-port-server
Advanced tools
IPFS server library for exposing IPFS node over message port
⛔️ DEPRECATED: js-IPFS has been superseded by Helia
📚 Learn more about this deprecation or how to migrate
⚠️ If you continue using this repo, please note that security fixes will not be provided
IPFS server library for exposing IPFS node over message port
$ npm i ipfs-message-port-server
<script>
tagLoading this module through a script tag will make it's exports available as IpfsMessagePortServer
in the global namespace.
<script src="https://unpkg.com/ipfs-message-port-server/dist/index.min.js"></script>
This library can wrap a JS IPFS node and expose it over the message channel.
It assumes ipfs-message-port-client
on the other end, however it is not
strictly necessary anything complying with the wire protocol will do.
It provides following API subset:
The server is designed to run in a SharedWorker (although it is possible to run it in the other JS contexts). The example below illustrates running a js-ipfs node in a SharedWorker and exposing it to all connected ports
import { create } from 'ipfs'
import { IPFSService, Server } from 'ipfs-message-port-server'
const main = async () => {
const connections = []
// queue connections that occur while node was starting.
self.onconnect = ({ports}) => connections.push(...ports)
const ipfs = await create()
const service = new IPFSService(ipfs)
const server = new Server(service)
// connect new ports and queued ports with the server.
self.onconnect = ({ports}) => server.connect(ports[0])
for (const port of connections.splice(0)) {
server.connect(port)
}
}
main()
Since the data sent over the message channel is copied via the structured cloning algorithm it may lead to suboptimal results (especially with large binary data). In order to avoid unnecessary copying the server will transfer all passed Transferables which will be emptied on the server side. This should not be a problem in general as IPFS node itself does not retain references to returned values, but is something to keep in mind when doing something custom.
Licensed under either of
Contributions welcome! Please check out the issues.
Also see our contributing document 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.
Unless 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.
FAQs
IPFS server library for exposing IPFS node over message port
The npm package ipfs-message-port-server receives a total of 13 weekly downloads. As such, ipfs-message-port-server popularity was classified as not popular.
We found that ipfs-message-port-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.