General purpose class for uploading blobs to drives

Hierarchy

  • EventEmitter<EventMap>
    • Upload

Constructors

Properties

basePath: string

The base path in the drive to add all the files to

blobs: Record<string, Record<string, BlobDescriptor>> = {}

The Blobs returned for each file upload, blobs[server][file.id]

complete: boolean = false
errors: Record<string, Record<string, Error>> = {}

The Error returned for each file upload, blobs[server][file.id]

files: {
    file: File;
    id: string;
    path: string;
}[] = []

The array of files to upload to the drive

Type declaration

  • file: File
  • id: string
  • path: string
running: boolean = false
servers: string[]

The array of blossom servers to upload the files to

signer: Signer

The signer used to sign auth events

status: Record<string, UploadFileStatus> = {}

Current upload status for each file

prefixed: string | boolean

Accessors

  • get progress(): number
  • Total upload progress

    Returns number

Methods

  • Add a single file to the upload

    Parameters

    • file: File
    • Optional path: string

    Returns Promise<void>

  • Add a FileList to the upload

    Parameters

    • fileList: FileList

    Returns Promise<void>

  • Read all files from a FileSystemEntry and add to the upload

    Parameters

    • entry: FileSystemEntry

    Returns Promise<void>

  • Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, keyof EventMap>]

          Returns void

    • Optional context: any

    Returns this

  • Calls each of the listeners registered for a given event.

    Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T
    • Rest ...args: ArgumentMap<EventMap>[Extract<T, keyof EventMap>]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns (keyof EventMap)[]

  • Return the number of listeners listening to a given event.

    Parameters

    • event: keyof EventMap

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, keyof EventMap>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Add a listener for a given event.

    Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, keyof EventMap>]

          Returns void

    • Optional context: any

    Returns this

  • Add a one-time listener for a given event.

    Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T
    • fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, keyof EventMap>]

          Returns void

    • Optional context: any

    Returns this

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: keyof EventMap

    Returns this

  • Remove the listeners of a given event.

    Type Parameters

    • T extends keyof EventMap

    Parameters

    • event: T
    • Optional fn: ((...args) => void)
        • (...args): void
        • Parameters

          • Rest ...args: ArgumentMap<EventMap>[Extract<T, keyof EventMap>]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns this

  • Start uploading the files to the servers

    Returns Promise<void>

Generated using TypeDoc