Skip to content

SlimIO/Prism

Repository files navigation

Prism

version Maintenance MIT

SlimIO Prism Addon. This addon has been designed to be a Distribution Server (it manage archive of Addons).

Getting Started

This package is available in the SlimIO Package Registry and can be easily installed with SlimIO CLI.

$ slimio --add prism
# or
$ slimio --add https://github.com/SlimIO/Prism

Tcp-Sdk code to transfert archives

// Require Node.js Dependencies
const { createReadStream } = require("fs");
const { resolve } = require("path");

// Require Third-party Dependencies
const TcpSdk = require("@slimio/tcp-sdk");

async function sendArchive(client, name) {
    const id = await client.sendOne("prism.start_bundle", name);

    const readStream = createReadStream(resolve("archives", name));
    try {
        for await (const chunk of readStream) {
            await client.sendOne("prism.send_bundle", [id, chunk.toJSON()]);
        }
        await client.sendOne("prism.end_bundle", id);
    }
    catch (error) {
        readStream.close();
    }
}

async function main() {
    const client = new TcpSdk({ host: "localhost", port: 1337 });
    client.catch((err) => console.error(err));
    await client.once("connect", 1000);

    try {
        await sendArchive(client, "Addon-aggregator-0.1.0.tar");

        // Send install callback (depending on your need).
        await client.sendOne("prism.install_archive", ["aggregator", "0.1.0"]);
    }
    finally {
        client.close();
    }
}
main().catch(console.error);

Dependencies

Name Refactoring Security Risk Usage
@lukeed/uuid Minor Low A tiny (230B), fast, and cryptographically secure UUID (v4) generator
@slimio/addon Minor Low Addon container
@slimio/tarball ⚠️Major High SlimIO Addon & module archive tarball packer/extractor
@slimio/timemap Minor Low ES6 Map-Like implementation with keys that have a defined timelife
semiver Minor Low A tiny (187B) utility to compare semver strings.
semver ⚠️Major Low Semver parser/utilities for node

License

MIT

About

Prism - Distribution Server Addon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •