Skip to content

A nodejs API that allows you to store your files on ipfs and retrieve them from ipfs based on the filename.

Notifications You must be signed in to change notification settings

Ahmedouu/Helia-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPFS-API

https://www.youtube.com/watch?v=q5bKjuu3kdE

A commonJS API that allows you to store your files on IPFS and retrieve them from IPFS based on the filename.

In ESM we would use ipfs-core or helia without dynamic importing, I want to do this in commonJS and use Helia and use dynamic imports.

This API spawns two HELIA nodes one is used to write files and one is used to retrieve them

Run the server

npm install
npm start

you have the first endpoint /upload

POST request --> body/Form-data --> key=file, value=yourfile.extension

example: Alt text

the second endpoint /retreive is like dis:

GET request body/raw/JSON,

{
    "filename": "the_name_of_the_file_you_uploaded.extension"
}

example:

Alt text

Questions

Why hashmaps ? well IPFS/Helia uses content addressing, there is no easy way to store the file with it's name and encodings, simply we just write the buffer and each buffer is under a CID, and I don't expect you to memorize the CID, i ALSO LOVE HASHMAPS <3

Why use createNode() twice ? for clarity, it's not needed though one node is good enough

About

A nodejs API that allows you to store your files on ipfs and retrieve them from ipfs based on the filename.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published