Options
Menu

@s3-publish/core Module

Index

Constructor Options Type aliases

SyncPlannerOptions

SyncPlannerOptions: { addMissing?: undefined | false | true; compare?: FilePairHandler<Promise<boolean>> | false; deleteOrphans?: undefined | false | true; limitCompares?: number | false; limitRequests?: number | false; origin: Provider; target: Provider }

Type declaration

  • Optional addMissing?: undefined | false | true

    Upload origin files that do not exist in target

    default

    true

  • Optional compare?: FilePairHandler<Promise<boolean>> | false
    • If a function is provided, it should return a Promise that resolves to false if originFile has changed
    • If false is provided, all non-ignored files will be uploaded (assume all files have changed)
    • If undefined is provided, the default comparator will be used (ETag properties must be equal)
    default

    undefined

  • Optional deleteOrphans?: undefined | false | true

    Delete target files that do not exist in origin

    default

    false

  • Optional limitCompares?: number | false

    The number of analyze jobs to execute in parallel

    default

    1

  • Optional limitRequests?: number | false

    The number of list requests to execute in parallel

    default

    1

  • origin: Provider

    The object that provides access to the source Files

  • target: Provider

    The object that provides access to the destination Files and creates operations to PUT/COPY/DELETE source files

Other Type aliases

File

File: { ETag?: undefined | string; Key: string; LastModified?: Date; Size?: undefined | number; SourceProvider: Provider }

Type declaration

  • Optional ETag?: undefined | string

    The entity tag is an MD5 hash of the object

    remarks

    ETag reflects only changes to the contents of an S3 object, not its metadata

  • Key: string

    The path to the File relative to the SourceProvider root

  • Optional LastModified?: Date

    The date the File was Last Modified

  • Optional Size?: undefined | number

    The File size in bytes

  • SourceProvider: Provider

FileHandler

FileHandler<R>: (file: File) => R

Type parameters

  • R

Type declaration

    • Parameters

      Returns R

FileMap

FileMap: Map<string, File>

FilePairHandler

FilePairHandler<R>: (originFile: File, targetFile: File) => R

Type parameters

  • R

Type declaration

    • (originFile: File, targetFile: File): R
    • Parameters

      Returns R

FilePredicate

FilePredicate: FileHandler<boolean>

Job

Job: () => Promise<void>

Type declaration

    • (): Promise<void>
    • Returns Promise<void>

ListFilesHandler

ListFilesHandler: (provider: Provider, result?: ListFilesResult) => void

Type declaration

ListFilesOptions

ListFilesOptions: { calculateETag?: undefined | false | true; limitRequests?: number | false; onIgnore?: FileHandler; onProgress?: ListFilesHandler; providers: Provider[] }

Type declaration

  • Optional calculateETag?: undefined | false | true

    If true, calculate ETag (md5 hash) for files (if not already defined)

    default

    false

  • Optional limitRequests?: number | false

    Max parallel file list requests

    default

    1

  • Optional onIgnore?: FileHandler

    Called for each ignored file

    default

    undefined

  • Optional onProgress?: ListFilesHandler

    Called twice for each provider (before start of list request and after list request finishes)

    default

    undefined

  • providers: Provider[]

    List files in these providers

ListFilesResult

ListFilesResult: { duration: number; files: FileMap }

Type declaration

  • duration: number

    Run time of the request in milliseconds

  • files: FileMap

PlanOptions

PlanOptions: { onIgnore?: FileHandler; onSkip?: undefined | ((event: SkipEvent) => void) }

Type declaration

  • Optional onIgnore?: FileHandler

    Called for each ignored File

    default

    undefined

  • Optional onSkip?: undefined | ((event: SkipEvent) => void)

    Called for each skipped File

    default

    undefined

ProviderOperation

ProviderOperation: { file: File; job: Job; params: unknown; reason?: Reason; type: "PUT" | "COPY" | "DELETE" }

Type declaration

  • file: File

    File object relevant to operation

  • job: Job

    Function that will be invoked when this operation is performed

  • params: unknown

    Request parameters

  • Optional reason?: Reason

    Reason for put/copy operation (undefined for delete)

  • type: "PUT" | "COPY" | "DELETE"

ProviderOperationResult

ProviderOperationResult: { duration: number }

Type declaration

  • duration: number

    Run time of the operation in milliseconds

Reason

Reason: "ADD" | "CHANGE"

RunOperationsHandler

RunOperationsHandler: (operation: ProviderOperation, result?: ProviderOperationResult) => void

Type declaration

RunOperationsOptions

RunOperationsOptions: { onProgress?: RunOperationsHandler; operations: ProviderOperation[]; parallel?: number | false }

Type declaration

  • Optional onProgress?: RunOperationsHandler

    Called twice for each operation (before start and after end)

    default

    undefined

  • operations: ProviderOperation[]

    Operations to run

  • Optional parallel?: number | false

    Max parallel operations

    default

    1

SkipEvent

SkipEvent: { file: File; reason: Reason; targetFile?: File }

Type declaration

  • file: File
  • reason: Reason
  • Optional targetFile?: File

    Undefined if reason is ADD

Functions

listFiles

runOperations

Generated using TypeDoc