How to Migrate Data from IPFS to Swarm Network: 5 Tools and Strategies Explained
You can migrate data from IPFS to the Swarm network using specialized command-line tools, JavaScript libraries, or Kubernetes orchestration platforms depending on your migration scale and technical requirements.
Migrating content from IPFS to the Swarm network requires selecting the right tooling approach for your specific use case. The ethersphere/awesome-swarm repository maintains a curated catalog of utilities that handle everything from single-file transfers to enterprise-scale data pipelines. This guide covers the five primary strategies for migrating data from IPFS to Swarm network, including specific file references and implementation patterns from the source code.
Direct CLI Migration with IPFS-to-Swarm
The IPFS-to-Swarm tool provides a zero-code solution for walking an IPFS DAG, fetching every block, and re-storing it on a Bee node using the Bee HTTP API.
This community-maintained CLI handles CID conversion, pinning on the source, and optional batch parallelisation while preserving the original IPFS directory structure and metadata. It works with any public or local IPFS gateway, making it ideal for one-off migrations.
According to the awesome-swarm source code, this tool is listed at line 76 in README.md under the migration tools section.
# Install the tool (requires Node.js)
npm install -g ipfs-to-swarm
# Migrate an IPFS CID to a local Bee node (default API: http://localhost:1633)
ipfs-to-swarm \
--ipfs-gateway https://ipfs.io/ipfs/ \
--bee-api http://localhost:1633 \
QmExampleCID
The command fetches the IPFS DAG from the public gateway, uploads each block to the Bee node, and prints the root Swarm hash.
Programmatic Migration with Bee-JS
For custom pipelines requiring selective migration, data transformation, or backend integration, the Bee-JS library provides the idiomatic JavaScript/TypeScript interface to Bee nodes.
A typical migration flow involves:
- Resolving an IPFS CID via an IPFS gateway or
ipfs-http-client. - Retrieving raw bytes through a streamed iterator.
- Uploading the payload using
bee.uploadFile()orbee.uploadDirectory(). - Storing the resulting Swarm reference (BZZ hash) for later lookup.
This approach embeds migration logic into CI pipelines, serverless functions, or desktop utilities. As documented in README.md at line 24, Bee-JS serves as the primary library for Bee interaction in the awesome-swarm catalog.
import { Bee } from '@ethersphere/bee-js'
import { create } from 'ipfs-http-client'
const bee = new Bee('http://localhost:1633')
const ipfs = create({ url: 'https://ipfs.io' })
async function migrate(cid) {
// Pull the IPFS object as a Buffer
const chunks = []
for await (const chunk of ipfs.cat(cid)) {
chunks.push(chunk)
}
const content = Buffer.concat(chunks)
// Upload to Swarm
const { reference } = await bee.uploadFile(content, { pin: true })
console.log(`IPFS ${cid} ➜ Swarm ${reference}`)
}
migrate('QmExampleCID')
The script streams the IPFS content, uploads it via Bee-JS, and pins the result to ensure persistence.
Batch Uploads Using Swarm CLI
When IPFS data is already available locally, the Swarm CLI provides the fastest path to Swarm network storage without writing code.
First, export the IPFS content locally:
ipfs get QmExampleCID -o ./my-data
Then upload the directory to Swarm with pinning enabled:
swarm upload ./my-data --pin --recursive
The --recursive flag walks the directory tree and creates a Swarm manifest that mirrors the original IPFS layout. The CLI supports progress reporting, optional encryption, and recursive directory uploads, making it ideal for ad-hoc scripts and quick migrations.
As listed in README.md at line 62, Swarm CLI appears under the Tools section of the awesome-swarm catalog.
CID Conversion with Swarm CID Converter
The Swarm CID Converter handles hash translation between IPFS and Swarm formats, enabling reference updates without re-uploading payload data.
This utility maps IPFS CIDs directly to their Swarm equivalents, supporting use cases where legacy links must remain functional after migration. It translates between multihash formats and integrates with other migration strategies to maintain database reference integrity.
The tool is documented in README.md at line 66 within the Tools section.
Cluster Orchestration with Beekeeper
For large-scale or repeatable migrations across multiple Bee nodes, Beekeeper offers Kubernetes-native orchestration capabilities.
This approach allows you to spin up temporary Bee clusters, run IPFS-to-Swarm jobs inside pods, and tear down infrastructure when complete. Beekeeper manages the lifecycle of Bee nodes during migration operations, providing scalability for enterprise data transfers.
Reference documentation appears in README.md at line 34 under the CI/CD section of the awesome-swarm repository.
Summary
- IPFS-to-Swarm CLI: Use this for zero-code, single-command migrations that preserve directory structures, referenced at line 76 in
README.md. - Bee-JS: Choose this JavaScript library for custom pipelines requiring programmatic control over migration logic, listed at line 24.
- Swarm CLI: Leverage this for batch uploads of locally exported IPFS data with recursive directory support, documented at line 62.
- Swarm CID Converter: Utilize this for mapping IPFS CIDs to Swarm references without re-uploading content, found at line 66.
- Beekeeper: Deploy this Kubernetes tool for orchestrated migrations across multiple Bee clusters at scale, located at line 34.
Frequently Asked Questions
How do I migrate a single IPFS CID to Swarm without writing code?
Use the IPFS-to-Swarm command-line tool. Install it via npm (npm install -g ipfs-to-swarm), then run the migration command specifying your IPFS gateway and Bee node API endpoint. The tool automatically fetches the IPFS DAG and uploads it to your Bee node, outputting the new Swarm reference.
Can I preserve my existing IPFS directory structure when migrating to Swarm?
Yes. Both the IPFS-to-Swarm CLI and Swarm CLI preserve directory hierarchies. The --recursive flag in Swarm CLI creates a Swarm manifest that mirrors the original IPFS layout, ensuring your file organization remains intact after migration.
What is the difference between using Bee-JS and the Swarm CLI for migration?
Bee-JS is a JavaScript library for building custom migration pipelines with fine-grained control over data transformation, filtering, and integration with existing backends. Swarm CLI is a standalone binary for direct file system operations requiring no code. Choose Bee-JS for programmatic workflows and Swarm CLI for simple file uploads.
How do I handle large-scale migrations involving multiple Bee nodes?
Use Beekeeper, the Kubernetes orchestration tool for Bee clusters. It allows you to provision temporary Bee nodes, execute migration jobs at scale, and decommission the infrastructure afterward. This approach is documented in the awesome-swarm catalog under the CI/CD section at line 34 of README.md.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →