Cloud

Date

2/14/2024 - 11:29:58 PM

Export

Constructors

Properties

_semaphores: {
    createDirectory: ISemaphore;
    directoryDownloads: ISemaphore;
    directoryUploads: ISemaphore;
    downloadStream: ISemaphore;
    downloadToLocal: ISemaphore;
    share: ISemaphore;
    uploads: ISemaphore;
} = ...

Type declaration

api: API
sdkConfig: FilenSDKConfig
utils: {
    signals: {
        PauseSignal: typeof PauseSignal;
    };
    utils: {
        calculateChunkIndices: ((param0) => [number, number]);
        readLocalFileChunk: ((param0) => Promise<Buffer>);
        readWebFileChunk: ((param0) => Promise<Buffer>);
    };
} = ...

Type declaration

  • signals: {
        PauseSignal: typeof PauseSignal;
    }
  • utils: {
        calculateChunkIndices: ((param0) => [number, number]);
        readLocalFileChunk: ((param0) => Promise<Buffer>);
        readWebFileChunk: ((param0) => Promise<Buffer>);
    }
    • calculateChunkIndices: ((param0) => [number, number])
        • (param0): [number, number]
        • Calculate the first and the last chunk of a file to fetch between startBytes and endBytes.

          Parameters

          • param0: {
                chunks: number;
                end: number;
                start: number;
            }
            • chunks: number
            • end: number
            • start: number

          Returns [number, number]

          Date

          3/18/2024 - 1:19:27 AM

          Export

    • readLocalFileChunk: ((param0) => Promise<Buffer>)
        • (param0): Promise<Buffer>
        • Reads a chunk from a local file.

          Parameters

          • param0: {
                length: number;
                offset: number;
                path: string;
            }
            • length: number
            • offset: number
            • path: string

          Returns Promise<Buffer>

          Date

          2/16/2024 - 5:45:19 AM

          Export

    • readWebFileChunk: ((param0) => Promise<Buffer>)
        • (param0): Promise<Buffer>
        • Reads a chunk from a web-based file, such as from an field.

          Parameters

          • param0: {
                file: File;
                index: number;
                length: number;
            }
            • file: File
            • index: number
            • length: number

          Returns Promise<Buffer>

          Date

          2/16/2024 - 5:45:27 AM

          Export

Methods

  • Private

    Add an item to a directory public link.

    Parameters

    Returns Promise<void>

    Date

    2/19/2024 - 5:08:51 AM

    Async

  • Change the color of a directory.

    Parameters

    • param0: {
          color: string;
          uuid: string;
      }
      • color: string
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 8:52:40 PM

    Async

  • Checks if the parent of an item is shared or public linked. If so, it adds the item and all children of the item (in case of a directory) to the share or public link.

    Parameters

    Returns Promise<void>

    Date

    2/17/2024 - 4:26:44 AM

    Async

  • Create a directory under parent.

    Parameters

    • param0: {
          name: string;
          parent: string;
          renameIfExists?: boolean;
          uuid?: string;
      }
      • name: string
      • parent: string
      • Optional renameIfExists?: boolean
      • Optional uuid?: string

    Returns Promise<string>

    Async

  • Permanently delete a directory.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 11:42:13 PM

    Async

  • Permanently delete a file.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 11:42:05 PM

    Async

  • Fetch contents of a directory public link or it's children.

    Parameters

    • param0: {
          key: string;
          parent: string;
          password?: string;
          salt?: string;
          uuid: string;
      }
      • key: string
      • parent: string
      • Optional password?: string
      • Optional salt?: string
      • uuid: string

    Returns Promise<DirLinkContentDecryptedResponse>

    Async

  • Fetch directory size in bytes, including file and folder count.

    Parameters

    • param0: {
          receiverId?: number;
          sharerId?: number;
          trash?: boolean;
          uuid: string;
      }
      • Optional receiverId?: number
      • Optional sharerId?: number
      • Optional trash?: boolean
      • uuid: string

    Returns Promise<{
        files: number;
        folders: number;
        size: number;
    }>

    Date

    2/20/2024 - 9:21:16 PM

    Async

  • Fetch size of a directory inside a public link in bytes, including file and folder count.

    Parameters

    • param0: {
          linkUUID: string;
          uuid: string;
      }
      • linkUUID: string
      • uuid: string

    Returns Promise<{
        files: number;
        folders: number;
        size: number;
    }>

    Date

    2/20/2024 - 9:21:53 PM

    Async

  • Recursively find the full path of a file using it's UUID.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<string>

    Async

  • Disable a file/directory public link.

    Parameters

    • param0: {
          itemUUID: string;
          type: "directory";
      }
      • itemUUID: string
      • type: "directory"

    Returns Promise<void>

    Date

    2/19/2024 - 4:47:27 AM

    Async

  • Disable a file/directory public link.

    Parameters

    • param0: {
          itemUUID: string;
          linkUUID: string;
          type: "file";
      }
      • itemUUID: string
      • linkUUID: string
      • type: "file"

    Returns Promise<void>

    Date

    2/19/2024 - 4:47:27 AM

    Async

  • Download a directory to path. Only available in a Node.JS environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          linkHasPassword?: boolean;
          linkKey?: string;
          linkPassword?: string;
          linkSalt?: string;
          linkUUID?: string;
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          pauseSignal?: PauseSignal;
          to?: string;
          type?: DirDownloadType;
          uuid: string;
      }
      • Optional abortSignal?: AbortSignal
      • Optional linkHasPassword?: boolean
      • Optional linkKey?: string
      • Optional linkPassword?: string
      • Optional linkSalt?: string
      • Optional linkUUID?: string
      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional pauseSignal?: PauseSignal
      • Optional to?: string
      • Optional type?: DirDownloadType
      • uuid: string

    Returns Promise<string>

    Async

  • Download a file to a local path. Only works in a Node.JS environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          bucket: string;
          chunks: number;
          end?: number;
          key: string;
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          pauseSignal?: PauseSignal;
          region: string;
          size: number;
          start?: number;
          to?: string;
          uuid: string;
          version: FileEncryptionVersion;
      }
      • Optional abortSignal?: AbortSignal
      • bucket: string
      • chunks: number
      • Optional end?: number
      • key: string
      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional pauseSignal?: PauseSignal
      • region: string
      • size: number
      • Optional start?: number
      • Optional to?: string
      • uuid: string
      • version: FileEncryptionVersion

    Returns Promise<string>

    Async

  • Download a file to a ReadableStream.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          bucket: string;
          chunks: number;
          end?: number;
          key: string;
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          pauseSignal?: PauseSignal;
          region: string;
          size: number;
          start?: number;
          uuid: string;
          version: FileEncryptionVersion;
      }
      • Optional abortSignal?: AbortSignal
      • bucket: string
      • chunks: number
      • Optional end?: number
      • key: string
      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional pauseSignal?: PauseSignal
      • region: string
      • size: number
      • Optional start?: number
      • uuid: string
      • version: FileEncryptionVersion

    Returns ReadableStream<Buffer>

  • Edit metadata of a file (currently uses the rename endpoint, might change later).

    Parameters

    Returns Promise<void>

    Async

  • Edit a file/directory public link.

    Parameters

    • param0: {
          enableDownload?: boolean;
          expiration: PublicLinkExpiration;
          itemUUID: string;
          linkUUID?: string;
          password?: string;
          type: "file" | "directory";
      }
      • Optional enableDownload?: boolean
      • expiration: PublicLinkExpiration
      • itemUUID: string
      • Optional linkUUID?: string
      • Optional password?: string
      • type: "file" | "directory"

    Returns Promise<void>

    Date

    2/19/2024 - 4:57:03 AM

    Async

  • Enable a public link for a file or a directory.

    Parameters

    Returns Promise<string>

    Date

    2/19/2024 - 5:13:57 AM

    Async

  • Toggle the favorite status of a directory.

    Parameters

    • param0: {
          favorite: boolean;
          uuid: string;
      }
      • favorite: boolean
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 8:54:03 PM

    Async

  • Toggle the favorite status of a file.

    Parameters

    • param0: {
          favorite: boolean;
          uuid: string;
      }
      • favorite: boolean
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 8:54:23 PM

    Async

  • Fetch info of a file public link.

    Parameters

    • param0: {
          key: string;
          password?: string;
          salt?: string;
          uuid: string;
      }
      • key: string
      • Optional password?: string
      • Optional salt?: string
      • uuid: string

    Returns Promise<Omit<FileLinkInfoResponse, "size"> & {
        size: number;
    }>

    Async

  • Recursively find the full path of a file using it's UUID.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<string>

    Async

  • Build a recursive directory tree which includes sub-directories and sub-files.

    Parameters

    • param0: {
          linkHasPassword?: boolean;
          linkKey?: string;
          linkPassword?: string;
          linkSalt?: string;
          linkUUID?: string;
          skipCache?: boolean;
          type?: DirDownloadType;
          uuid: string;
      }
      • Optional linkHasPassword?: boolean
      • Optional linkKey?: string
      • Optional linkPassword?: string
      • Optional linkSalt?: string
      • Optional linkUUID?: string
      • Optional skipCache?: boolean
      • Optional type?: DirDownloadType
      • uuid: string

    Returns Promise<Record<string, CloudItemTree>>

    Date

    2/22/2024 - 1:45:28 AM

    Async

  • Lists all files and directories in a directory.

    Parameters

    • param0: {
          onlyDirectories?: boolean;
          uuid: string;
      }
      • Optional onlyDirectories?: boolean
      • uuid: string

    Returns Promise<CloudItem[]>

    Date

    3/14/2024 - 5:21:55 AM

    Async

  • List shared in files and directories based on parent.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<CloudItemShared[]>

    Date

    2/15/2024 - 1:16:49 AM

    Async

  • List shared out files and directories based on parent.

    Parameters

    • param0: {
          receiverId?: number;
          uuid: string;
      }
      • Optional receiverId?: number
      • uuid: string

    Returns Promise<CloudItemShared[]>

    Date

    2/15/2024 - 1:16:32 AM

    Async

  • Move a directory.

    Parameters

    • param0: {
          metadata: FolderMetadata;
          overwriteIfExists?: boolean;
          to: string;
          uuid: string;
      }
      • metadata: FolderMetadata
      • Optional overwriteIfExists?: boolean
      • to: string
      • uuid: string

    Returns Promise<void>

    Async

  • Move a file.

    Parameters

    • param0: {
          metadata: FileMetadata;
          overwriteIfExists?: boolean;
          to: string;
          uuid: string;
      }
      • metadata: FileMetadata
      • Optional overwriteIfExists?: boolean
      • to: string
      • uuid: string

    Returns Promise<void>

    Async

  • Stop receiving a shared item.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/19/2024 - 4:38:36 AM

    Async

  • Rename a directory.

    Parameters

    • param0: {
          name: string;
          overwriteIfExists?: boolean;
          uuid: string;
      }
      • name: string
      • Optional overwriteIfExists?: boolean
      • uuid: string

    Returns Promise<void>

    Async

  • Rename a file.

    Parameters

    • param0: {
          metadata: FileMetadata;
          name: string;
          overwriteIfExists?: boolean;
          uuid: string;
      }
      • metadata: FileMetadata
      • name: string
      • Optional overwriteIfExists?: boolean
      • uuid: string

    Returns Promise<void>

    Async

  • Private

    Rename a publicly linked item.

    Parameters

    Returns Promise<void>

    Date

    2/17/2024 - 4:35:07 AM

    Async

  • Private

    Rename a shared item.

    Parameters

    Returns Promise<void>

    Date

    2/17/2024 - 4:32:56 AM

    Async

  • Restore a directory from the trash.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 11:43:29 PM

    Async

  • Restore a file from the trash.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 11:43:21 PM

    Async

  • Restore a file version.

    Parameters

    • param0: {
          currentUUID: string;
          uuid: string;
      }
      • currentUUID: string
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 11:44:51 PM

    Async

  • Private

    Share an item to another Filen user.

    Parameters

    • param0: {
          email: string;
          metadata: FileMetadata | FolderMetadata;
          parent: string;
          publicKey: string;
          type: "file" | "folder";
          uuid: string;
      }

    Returns Promise<void>

    Date

    2/17/2024 - 4:11:05 AM

    Async

  • Share a file or a directory (and all it's children) to a user.

    Parameters

    • param0: {
          directories: {
              metadata: FolderMetadata;
              parent: string;
              uuid: string;
          }[];
          email: string;
          files: {
              metadata: FileMetadata;
              parent: string;
              uuid: string;
          }[];
          onProgress?: ProgressWithTotalCallback;
      }

    Returns Promise<void>

    Date

    2/19/2024 - 4:35:03 AM

    Async

  • Stop sharing an item with another user.

    Parameters

    • param0: {
          receiverId: number;
          uuid: string;
      }
      • receiverId: number
      • uuid: string

    Returns Promise<void>

    Date

    2/19/2024 - 4:38:21 AM

    Async

  • Send a directory to the trash bin.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 2:07:13 AM

    Async

  • Send a file to the trash bin.

    Parameters

    • param0: {
          uuid: string;
      }
      • uuid: string

    Returns Promise<void>

    Date

    2/15/2024 - 2:07:13 AM

    Async

  • Upload a web-based directory, such as from an field. Only works in a browser environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          files: {
              file: File;
              path: string;
          }[];
          name?: string;
          onDirectoryCreated?: ((item) => void);
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          onUploaded?: ((item) => Promise<void>);
          parent: string;
          pauseSignal?: PauseSignal;
          throwOnSingleFileUploadError?: boolean;
      }
      • Optional abortSignal?: AbortSignal
      • files: {
            file: File;
            path: string;
        }[]
      • Optional name?: string
      • Optional onDirectoryCreated?: ((item) => void)
          • (item): void
          • Parameters

            Returns void

      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional onUploaded?: ((item) => Promise<void>)
          • (item): Promise<void>
          • Parameters

            Returns Promise<void>

      • parent: string
      • Optional pauseSignal?: PauseSignal
      • Optional throwOnSingleFileUploadError?: boolean

    Returns Promise<void>

    Async

  • Upload a local file at path. Only works in a Node.JS environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          name?: string;
          onDirectoryCreated?: ((item) => void);
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          onUploaded?: ((item) => Promise<void>);
          parent: string;
          pauseSignal?: PauseSignal;
          source: string;
          throwOnSingleFileUploadError?: boolean;
      }
      • Optional abortSignal?: AbortSignal
      • Optional name?: string
      • Optional onDirectoryCreated?: ((item) => void)
          • (item): void
          • Parameters

            Returns void

      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional onUploaded?: ((item) => Promise<void>)
          • (item): Promise<void>
          • Parameters

            Returns Promise<void>

      • parent: string
      • Optional pauseSignal?: PauseSignal
      • source: string
      • Optional throwOnSingleFileUploadError?: boolean

    Returns Promise<void>

    Async

  • Upload a local file. Only available in a Node.JS environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          name?: string;
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          onUploaded?: ((item) => Promise<void>);
          parent: string;
          pauseSignal?: PauseSignal;
          source: string;
      }
      • Optional abortSignal?: AbortSignal
      • Optional name?: string
      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional onUploaded?: ((item) => Promise<void>)
          • (item): Promise<void>
          • Parameters

            Returns Promise<void>

      • parent: string
      • Optional pauseSignal?: PauseSignal
      • source: string

    Returns Promise<CloudItem>

    Async

  • Upload a file using Node.JS streams. It's not as fast as the normal uploadFile function since it's not completely multithreaded. Only available in a Node.JS environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          creation?: number;
          lastModified?: number;
          name: string;
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          onUploaded?: ((item) => Promise<void>);
          parent: string;
          pauseSignal?: PauseSignal;
          source: ReadableStream;
      }
      • Optional abortSignal?: AbortSignal
      • Optional creation?: number
      • Optional lastModified?: number
      • name: string
      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional onUploaded?: ((item) => Promise<void>)
          • (item): Promise<void>
          • Parameters

            Returns Promise<void>

      • parent: string
      • Optional pauseSignal?: PauseSignal
      • source: ReadableStream

    Returns Promise<CloudItem>

    Async

  • Upload a web-based file, such as from an field. Only works in a browser environment.

    Parameters

    • param0: {
          abortSignal?: AbortSignal;
          file: File;
          name?: string;
          onError?: ((err) => void);
          onFinished?: (() => void);
          onProgress?: ProgressCallback;
          onProgressId?: string;
          onQueued?: (() => void);
          onStarted?: (() => void);
          onUploaded?: ((item) => Promise<void>);
          parent: string;
          pauseSignal?: PauseSignal;
          uuid?: string;
      }
      • Optional abortSignal?: AbortSignal
      • file: File
      • Optional name?: string
      • Optional onError?: ((err) => void)
          • (err): void
          • Parameters

            Returns void

      • Optional onFinished?: (() => void)
          • (): void
          • Returns void

      • Optional onProgress?: ProgressCallback
      • Optional onProgressId?: string
      • Optional onQueued?: (() => void)
          • (): void
          • Returns void

      • Optional onStarted?: (() => void)
          • (): void
          • Returns void

      • Optional onUploaded?: ((item) => Promise<void>)
          • (item): Promise<void>
          • Parameters

            Returns Promise<void>

      • parent: string
      • Optional pauseSignal?: PauseSignal
      • Optional uuid?: string

    Returns Promise<CloudItem>

    Async

Generated using TypeDoc