DEV Community

Cover image for IPFS File Encryption in NodeJS
Ilya Nevolin
Ilya Nevolin

Posted on • Updated on

IPFS File Encryption in NodeJS

IPFS is the InterPlanetary File System, it's a protocol and peer-to-peer network for storing and sharing data in a distributed file system. IPFS uses content-addressing to uniquely identify each file in a global namespace connecting all computing devices.

Recently I've implemented a sample project that allows us to encrypt/decrypt files for storing them on IPFS. Which is an ideal solution to hosting and securing any sensitive data.

Github project:

On my Github page I explain how to encrypt files prior to uploading them to IPFS. Similarly it can decrypt and download these files. The solution uses both RSA and AES encryption algorithms to achieve maximum security.


IPFS dominates over bittorrent in terms of availability and performance. Due to content-addressing it prevents file duplication.

Individual file(s) can be easily downloaded from some "source";
whereas with Bittorrent one has to create a ".torrent" file, submit it to tracker(s) and seed it.

IPFS on the other hand is much faster on making files available for sharing. IPFS files can be distributed and load-balanced, making it a perfect CDN solution. This isn't possible with BitTorrent at all.

File-streaming works out of the box over HTTP in IPFS.
Whereas streaming in BitTorrent is a paid feature.

Large files are being chunked/sharded in IPFS. So one can download chunks from different nodes and maximize bandwidth usage. This is both done in IPFS and BitTorrent.

BitTorrent has a high barrier to entry for new people trying to share files. Whereas IPFS easily integrates to a drag-and-drop interface.

With IPFS one chooses which files he/she wants to "seed".
While BitTorrent requires you to seed all files within the torrent.

    BitTorrent clients did improve over the years,
    it is possible to download file subsets,
    and it may be possile to seed file subsets.
Enter fullscreen mode Exit fullscreen mode

IPFS works over HTTP REST, whereas torrents only work over the BitTorrent protocol. This makes it harder for the community to build p2p apps/services/solutions.

Top comments (2)

codr profile image
Ilya Nevolin

The link has been updated to my new GitHub account -