Skip to content

lambdaclass/go-http-ipfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dependencies

Setup

  1. Install Go
  2. Install IPFS
  3. Get get-ipfs-api by doing: go get -u github.com/ipfs/go-ipfs-api
  4. Start the IPFS daemon: ipfs daemon
  5. In a new shell clone and move into this directory: git clone https://github.com/lambdaclass/go-http-ipfs.git && go-http-ipfs
  6. Build and run the Go server: go run

Now you will have the HTTP server running in port 8080.

Endpoints

/upload

This endpoint receives the file the user wants to upload to IPFS. The request must be a POST with a multipart form in which the field file has the file to upload.

Example:

$> curl localhost:8000/upload -F 'file=@example.txt'
QmbZGZZFbc9eFB1hfZj8PHsp8ZrszwXgf3nkrFx8z3v6ri

/file/:hash

This endpoint fetches a file from IPFS using its hash and returns it to the client for download. The request must be a GET where :hash is the hash identifying the file in IPFS

Example:

curl localhost:8000/file/QmbZGZZFbc9eFB1hfZj8PHsp8ZrszwXgf3nkrFx8z3v6ri -O

About

HTTP server in Go to interact with a local IPFS node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages