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

fvi-skynet-client

v0.0.7

Published

FVI - Skynet Clinet Library

Downloads

4

Readme

‘Own The Internet’ Hackathon

  • Hackathon page: https://gitcoin.co/hackathon/own-the-internet

Handshake

  • Project page: https://handshake.org
  • Learn Center: https://learn.namebase.io

Sia

  • Project page: https://siasky.net
  • Docs: https://sia.tech/docs/#skynet

Freunde Von Ideen - Node Skynet Client Library

Node Skynet Client Library using fvi-axios-client.

Using

  • Terminal
mkdir test-skynet
cd test-skynet
npm install --save fvi-skynet-client
touch index.js
vi index.js
  • Vi (Text editor)
const skynet = require('fvi-skynet-client')

// URL default is http://siasky.net.
// Other options follows [axios config](https://github.com/axios/axios).
const opts = {}
const client = skynet(opts)

Upload File

const fs = require('fs')

const opts = {
    endpoint: '/skynet/skyfile', // optional
    filename: null, // optional
}
const stream = fs.createReadStream('test.xyz')

client
    .uploadFile(stream, opts)
    .then(res => console.log(res))
    .catch(e => console.error(e))

/*
Example of success print:
{
    skylink: 'CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg',
    merkleroot: 'QAf9Q7dBSbMarLvyeE6HTQmwhr7RX9VMrP9xIMzpU3I',
    bitfield: 2048,
}
*/

Upload Directory

const fs = require('fs')

const opts = {
    endpoint: '/skynet/skyfile', // optional
    filename: null, // optional
}
const files = fs.readdirSync('dirnamehere')
const streams = files.map(f => fs.createReadStream(f))

client
    .uploadDirectory(streams, opts)
    .then(res => console.log(res))
    .catch(e => console.error(e))
/*
Example of success print:
{
    skylink: 'CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg',
    merkleroot: 'QAf9Q7dBSbMarLvyeE6HTQmwhr7RX9VMrP9xIMzpU3I',
    bitfield: 2048,
}
*/

Download

client
    .download('sia://CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg')
    .then(res => console.log(res))
    .catch(e => console.error(e))

Statistics

client
    .statistics()
    .then(res => console.log(res))
    .catch(e => console.error(e))

/*
Example of success print:
{
    uptime: 1234,
    uploadstats: {
        numfiles: 2,
        totalsize: 44527895,
    },
    versioninfo: {
        version: '1.4.4-master',
        gitrevision: 'cd5a83712',
    },
    performancestats: {
        // Fields omitted
    },
}
*/

Mock

The mock object follows the axios adapter mock.

const fs = require('fs')

if (client.mock) {
    const stream = fs.createReadStream('mock.xyz')
    client.mock.onPost(`/skynet/skyfile`).reply(200, { mock: true })
    client.mock.onGet(`/CABAB_1Dt0FJsxqsu_J4TodNCbCGvtFf1Uys_3EgzOlTcg`).reply(200, stream)
}

Audit

fvi-skynet-client

  • npm run compile: Clean temp files and e directories.
  • npm run debug-test: Run mocha unit tests with DEBUG enabled.
  • npm run test: Run mocha unit tests.
  • npm run debug-dev: Run dev mode, waiting for changes to run unit tests with DEBUG enabled (watch mode).
  • npm run dev: Run dev mode, waiting for changes to run unit tests.
  • npm run prod: Run with NODE_ENV=production.
  • npm run coverage: Run unit tests and coverage with nyc.
  • npm run release: Init git flow release from next package version, patch, git flow.
  • npm run release:minor: Init git flow release from next package version, minor, git flow.
  • npm run release:major: Init git flow release from next package version, major, git flow release start.
  • npm run release:finish: Finish current releas, git flow.