npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fission-suite/client

v2.0.5

Published

Fission Web API TypeScript Client

Downloads

21

Readme

FISSION IPFS Web API

NPM License Build Status Maintainability Built by FISSION Discord

A TypeScript client library for access accessing the FISSION Web API.

Installing

$ npm install --save @fission-suite/client

API

Utility

getContentURL

Returns the url to access the given CID on our service.

Params:

  • cid: CID (string) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { getContentURL } from '@fission-suite/client'
const formattedURL = getContentURL("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u")
// "https://runfission.com/ipfs/QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u"

Unauthenticated

register

Registers a user for the Fission service.

Params:

  • username: string required
  • password: string required
  • email: string

Example:

import { register } from '@fission-suite/client'
await register("username", "password", "[email protected]")

peers

Gets the address for all IPFS nodes in the Fission Network.

Example:

import { peers } from '@fission-suite/client'
await peers()
// [
//   '/ip4/3.215.160.238/tcp/4001/ipfs/QmVLEz2SxoNiFnuyLpbXsH6SvjPTrHNMU88vCQZyhgBzgw',
//   '/ip4/184.68.124.102/tcp/64417/ipfs/QmQ2Jo91xQyVjhw1kmpk9eeHj6A4W1u5BYdh5xjfC5h11g'
// ]

content

Returns content at given CID.

Params:

  • cid: CID (string) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { content } from '@fission-suite/client'
const helloWorld = await content("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u")
// "Hello World"

Authenticated

These methods require a username/password from the fission webserver. These can be provisioned through our Fission CLI.

verify

Verifies the given credentialls.

Params:

  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { verify } from '@fission-suite/client'
await verify({ username: "username", password: "password" })
// true

resetPassword

Verifies the given credentialls.

Params:

  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { resetPassword } from '@fission-suite/client'
await resetPassword("newPassword", { username: "username", password: "password" })
// "newPassword"

add

Adds content to IPFS and returns the CID of that content.

Params:

  • content: Content (json, string, file-stream) required
  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com
  • name: string optional name for your file, defaults to undefined

Example:

import { add } from '@fission-suite/client'
const auth = { username: "username", password: "password" }
const content = {
  key1: 123,
  key2: 456
}
const cid = await add(content, auth)
// "QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u"

remove

Unpins content from Fission server and disassociates CID with user account.

Params:

  • cid: CID (string) required
  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { remove } from '@fission-suite/client'
const auth = { username: "username", password: "password" }
await remove("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u", auth)
// undefined

pin

Pins content to Fission server.

Params:

  • cid: CID (string) required
  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { pin } from '@fission-suite/client'
const auth = { username: "username", password: "password" }
await pin("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u", auth)
// undefined

cids

Gets all CIDs associated with the given user.

Params:

  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { cids } from '@fission-suite/client'
const auth = { username: "username", password: "password" }
await cids(auth)
// [
//   "QmYwXpFw1QGAWxEnQWFwLuVpdbupaBcEz2DTTRRRsCt9WR",
//   "QmYp9d8BC2HhDCUVH7JEUZAd6Hbxrc5wBRfUs8TqazJJP9",
// ]

updateDNS

Updates the users associated subdomain to point at the given CID

Params:

  • cid: CID (string) required
  • auth: Auth ({username: string, password: string}) required
  • baseURL: string defaults to fission web-api at https://runfission.com

Example:

import { updateDNS } from '@fission-suite/client'
const auth = { username: "username", password: "password" }
await updateDNS("QmYwXpFw1QGAWxEnQWFwLuVpdbupaBcEz2DTTRRRsCt9WR", auth)
// "username.runfission.com"

Fission objects

For repeated calls, instantiate a fission object:

import Fission, { FissionUser } from '@fission-suite/client'

const fission = new Fission("https://someurl.com")
const helloWorld = await fission.content("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u")

const fissionUser = fission.login("username", "password")
// Alternately:
// const fissionUser = new FissionUser("username", "password", "https://someurl.com")

const cid =  await fissionUser.add("Check this out!")
await fissionUser.pin(cid)

const cids = fissionUser.cids()

Testing

  • Run npm i
  • Run tests with: npm run test
  • Or achieve developer zen with npm run test:watch