Skip to main content
info:

Asynchronous IPFS client library

aioipfs is a python3 library providing an asynchronous API for IPFS

Installation

pip install aioipfs

Usage examples

Get an IPFS resource

import sys
import asyncio

import aioipfs

async def get(ipfshash):
    client = aioipfs.AsyncIPFS()
    await client.get(ipfshash, dstdir='.')
    await client.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(get(sys.argv[1]))
loop.close()

Add some files

This example will import all files and directories specified on the command line. Note that the add API function is an asynchronous generator and therefore needs to be used with the async for syntax.

import sys
import asyncio

import aioipfs

async def add_files(files):
    client = aioipfs.AsyncIPFS()

    async for added_file in client.add(*files, recursive=True):
        print('Imported file {0}, CID: {1}'.format(
            added_file['Name'], added_file['Hash']))

    await client.close()

loop = asyncio.get_event_loop()
loop.run_until_complete(add_files(sys.argv[1:]))
loop.close()

Pubsub service

async def pubsub_serve(topic):
    async with aioipfs.AsyncIPFS() as cli:
        async for message in cli.pubsub.sub(topic):
            print('Received message from', message['from'])
            await cli.pubsub.pub(topic, message['data'])

Features

Async file writing on get operations

The aiofiles library is used to asynchronously write data retrieved from the IPFS daemon when using the /api/v0/get API call, to avoid blocking the event loop. TAR extraction is done in asyncio’s threadpool.

Requirements

License

aioipfs is offered under the GNU Lesser GPL3 (LGPL3) license.

Metadata

Release files for aioipfs 0.4.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aioipfs 0.4.8
File Size Uploaded
aioipfs-0.4.8.tar.gz 25.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aioipfs 0.4.8
File Interpreter ABI Platform
aioipfs-0.4.8-py3-none-any.whl Python 3 none any Details

Total release size: 50.2 kB

Release files / aioipfs-0.4.8.tar.gz

Download URL aioipfs-0.4.8.tar.gz
Size 25.6 kB
Tags Source
SHA-256 checksum
How to use checksums
34b5ab79503c90098e5eece51aee96850406b22eca87f99c257d6fadac1b2fb9
BLAKE2b-256 checksum
How to use checksums
857854dd315ebf102c51aed58d4621596e1516ac64ea82da4c0be82c2fcd4ac2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

Release files / aioipfs-0.4.8-py3-none-any.whl

Download URL aioipfs-0.4.8-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c8c109301bcaf05fef5245716dd78316f30352b5438bf5a573b5272ae73cde0
BLAKE2b-256 checksum
How to use checksums
a0277b2220db5c18d9da79fb272869b550d4fa4ac92130396f59cf188074b7ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

Release history Release notifications | RSS feed

0.7.1

2 release files

0.7.0

2 release files

0.6.9

2 release files

0.6.8

2 release files

0.6.7

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.9

2 release files

This release

0.4.8 This release

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

1 release file

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page