GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - siiky/ipfs.lua: [MOVED] Client for the Kubo RPC API

This repository was archived by the owner on Feb 9, 2024. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 
example.lua
example.lua
 
 
http.lua
http.lua
 
 
ipfs-0.0.14-1.rockspec
ipfs-0.0.14-1.rockspec
 
 
ipfs-endpoints.lua
ipfs-endpoints.lua
 
 
ipfs.lua
ipfs.lua
 
 
util.lua
util.lua
 
 

Repository files navigation

ipfs.lua

Lua library for the Kubo RPC API, the reference IPFS node implementation.

Endpoint definitions (ipfs-enpoints.lua) are generated with export-to-lua.scm from ipfs.scm.


Most of the requirements for ipfs.scm also apply here. You must be familiar with the IPFS HTTP API if you want to use this library. It tries to catch some bad usage but it's not very strict.

Each exported procedure represents one endpoint -- see the note on ipfs.scm about missing endpoints. In general, /api/v0/some/endpoint will be used as ipfs:some_endpoint -- more specifically, [-/] are replaced with _ to make the endpoint name a valid Lua identifier. For example, id is called id, bootstrap/list is called bootstrap_list, and diag/cmds/set-time is called diag_cmds_set_time.

The reader, writer, and timeout may all be overwritten on a per-call basis.

Usage

-- There are some "module parameters":
local IPFS = require('ipfs')({
  -- Both readers are optional. If not given, none will be used and you must
  -- manually "read" the HTTP stream.
  reader_json=...,
  reader_plain=...,
})

-- And "instance parameters":
local ipfs = IPFS({
  -- The connection details and their defaults:
  scheme='http',
  host="localhost",
  port=5001,

  -- Optionally (see the http rock):
  timeout=...,
})

-- OR:

--[[
local ipfs = require('ipfs')({
  reader_json=...,
  reader_plain=...,
})({
  scheme='http',
  host="localhost",
  port=5001,
  timeout=...,
})
--]]

-- No arguments, parameters, nor options given. Calls the `/api/v0/id`
-- endpoint with the default reader, writer, and timeout.
ipfs:id()

-- The recognized options are `reader`, `writer`, and `timeout`.
ipfs:id(nil, {}, {reader=..., writer=..., timeout=...})

-- The reader may be skipped on a per-call basis if given and truthy but not a
-- procedure.
ipfs:id({}, nil, {reader=true})

-- Unexpected arguments/parameters, i.e., arguments/parameters that are no
-- specified in the endpoint's definition, are ignored.
ipfs:id({1, 2, 3}, {another="thing"})

Also check out example.lua.

About

[MOVED] Client for the Kubo RPC API

git.sr.ht/~siiky/ipfs.lua

Topics

ipfsipfs-apikubolua

Resources

Readme
Unlicense
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.