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

@sliksafe/slik-files

v0.9.28

Published

Slik offers you the ability to upload or download files with end-to-end encryption as a simple drop in NPM package

Downloads

102

Readme

Decentralized Storage

Slik offers you the ability to upload or download files with end-to-end encryption to the decentralized web as a simple drop in NPM package.

Using the slik-files package, you can enable a native upload and download experience for your users within your app. All files uploaded from the slik-files package are backed up to a decentralized storage and replicated across a globally distributed network of nodes.

Demo

You can play around with the demo app that uses the slik-files SDK at: https://slikfilesdemo.web.app

API Keys

Before getting started you would need an API key. Create an API key via the console: https://console.developers.sliksafe.com

Docs

Please see a few samples below, but you can find the detailed docs here: https://slik.gitbook.io/docs/packages/upload-and-download-files

Install via yarn

yarn add @sliksafe/slik-files

Upload a File

You can simply upload a file by calling the uploadFile method after initializing the library. The upload method accepts different parameters based on your requirements, specified in detail below.

// Import SlikFiles
import { SlikFiles } from '@sliksafe/slik-files'

// Initialize slik-files
const initParams = { apiKey: "api_key_string" }
const filesHandler = await SlikFiles.initialize(initParams)

// A file-like object with raw data. The File interface inherits from Blob.
// Assign the file object received after uploading a file.
let file: File = 

// Upload a file with upload options
const uploadOptions = { 
    networks: ["filecoin"],
    walletAddress: "0x5c14E7A5e9D4568Bb8B1ebEE2ceB2E32Faee1311",
    file: file,
    isEncrypted: false,
}

filesHandler.uploadFile(uploadOptions, (uploadHandle, fileId, err) => {
    console.log("The unique identifier of the file uploaded: ", fileId);
    
    if (!!err) {
      console.error('Failed to upload file: ', err)
    } else {
      console.log("Uploading file progress: ", uploadHandle);
      setUploadDownloadProgress(uploadHandle.percentage);

      if (uploadHandle.status === "uploaded") {
        console.log("File upload finished");
        console.log("The unique identifier of the file uploaded: ", fileId);
      }
    }
});

Download a File

You can download a file using the same fileHandler as initialized above and the downloadFile method.

// Download a file with download options
const downloadOptions = { 
    fileId: "-N-ZESm8wbGeFuxpawPi",
    walletAddress: "0x5c14E7A5e9D4568Bb8B1ebEE2ceB2E32Faee1311",
}

filesHandler.downloadFile(downloadOptions, (downloadHandle, file, err) => {
    console.log("Downloading file progress: ", downloadHandle.percentage);
    
    if (downloadHandle.status === "downloaded") {
        console.log("File download finished");
        console.log("Downloaded file: ", file);
    }
});

Privacy

The slik-files package automagically handles end-to-end encryption for you when you specify the isEncrypted flag during upload.

When specified, each file is encrypted using military grade AES-256 symmetric key encryption, before it is stored on decentralized storage. Also, the file is seamlessly decrypted after being downloaded and before being returned back to you in the downloadFile method.

Public Files

You can disable end-to-end encryption for files by simply setting the property isEncrypted as false while uploading the file.

Scalability

The Slik infrastructure has been designed to scale with the needs of the developer. It is currently used by thousands of users worldwide to backup terabytes of data.