Nighttime Pachinko Marathon

    darken-sdk

    0.1.0 • Public • Published

    Darken SDK

    Darken is a mirroring client. This JavaScript SDK is for developing apps that interact with Darken registries.

    How it works

    First, the patcher downloads a manifest describing all of the files to be synchronized. Then, it verifies whether the local copy of each file in the manifest has a hash that matches the hash in the manifest. For each file in the manifest that either does not exist locally or whose hash does not match, the patcher will download that file.

    Usage

    import { darken } from 'darken-sdk';
    
    darken({
      // OPTIONAL: The path on the local filesystem to be synced with the repo.
      path: process.cwd(),
    
      // OPTIONAL: The Darken registry URL
      registry: 'https://darken.sh',
    
      // OPTIONAL: The name of the Darken repo to pull
      repo: '@stable/blank',
    
      // OPTIONAL: Callbacks to integrate with Darken internals
      telemetry: {
        onFile(name) {
          // Called for each file in the manifest immediately after reading its manifest entry.
        },
    
        onFileError(name, error) {
          // Called if there was an error downloading or writing a file in the manifest.
        },
    
        onFileReady(name) {
          // Called when a file exists locally and has a hash matching the hash in the manifest.
        },
    
        onFileUpdate(name) {
          // Called when a file in the manifest either does not exist locally or has a hash that does not match its hash in the manifest.
        },
    
        onFileUpdateProgress(name, bytesProgress, bytesTotal) {
          // Called when downloading a file whenever progress is made
        },
    
        onManifest() {
          // Called immediately upon receiving the manifest.
        },
    
        onManifestError(error) {
          // Called if there was an error reading or validating the manifest.
        }
      }
    });

    Keywords

    none

    Install

    npm i darken-sdk

    DownloadsWeekly Downloads

    3

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    8.9 kB

    Total Files

    5

    Last publish

    Collaborators

    • canterberry