Hierarchy (view full)

Constructors

Properties

_metadata: DriveMetadata = ...
decoder: TextDecoder = ...
encoder: TextEncoder = ...
event?: EventTemplate | SignedEvent
locked: boolean = true
logn: number = DEFAULT_SCRYPT_LOGN
modified: boolean = false

whether the drive has been modified and needs to be saved

publisher: Publisher
signer: Signer
prefixed: string | boolean

Accessors

  • get address(): "" | `naddr1${string}`
  • Returns "" | `naddr1${string}`

  • get description(): string
  • Returns string

  • set description(v): void
  • Parameters

    • v: string

    Returns void

  • get identifier(): string
  • Returns string

  • set identifier(v): void
  • Parameters

    • v: string

    Returns void

  • get name(): string
  • Returns string

  • set name(v): void
  • Parameters

    • v: string

    Returns void

  • get pubkey(): undefined | string
  • Returns undefined | string

  • get servers(): string[]
  • Returns string[]

  • set servers(v): void
  • Parameters

    • v: string[]

    Returns void

Methods

  • Iterate over the files

    Returns IterableIterator<TreeFile | TreeFolder>

    Example

    for(let fileOrFolder of drive){
    if(fileOrFolder instanceof TreeFolder){
    // keep looping
    }
    else if(fileOrFolder instanceof TreeFile){
    console.log(fileOrFolder.path)
    }
    }
  • 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

  • Decrypt a Blob with the drives password

    Parameters

    • blob: Blob
    • Optional type: string

    Returns Promise<Blob>

  • Download and Decrypt a file at the provided path

    Parameters

    • path: Path
    • additionalServers: string[] = []

    Returns Promise<null | File>

  • 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

  • Encrypt a Blob with the drives password

    Parameters

    • blob: Blob

    Returns Promise<Blob>

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

    Returns (keyof EventMap)[]

  • Checks if there is a file with a matching sha256 hash

    Parameters

    • sha256: string

    Returns boolean

  • 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

  • Save any pending changes to nostr

    Returns Promise<undefined | SignedEvent>

  • Used to set the password on new drives

    Parameters

    • password: string
    • logn: number = DEFAULT_SCRYPT_LOGN

    Returns void

  • Attempts to decrypt the drive with the provided password If successful it will set locked=false and save the password in memory

    Parameters

    • password: string

    Returns Promise<void>

Generated using TypeDoc