backblaze-labs/b2-action - v1.1.0
    Preparing search index...

    Function findFileByName

    • Resolve an exact file name only when its latest version is an upload. If the latest exact-name version is a hide marker, this intentionally reports the file as not found instead of selecting an older upload from version history or revealing hidden-object existence in default workflow logs. Throws when the latest exact-name state is hidden, deleted, or absent. Used by copy, delete, and retention to resolve a file name to a fileId before operating on it.

      Consistency assumption: B2's listFileNames is read-after-write consistent for a recently-uploaded file in the same region. The simulator returns uploads immediately; production B2 in practice does the same, but a caller that chains "upload then operate on the same name" across two action steps is relying on observed behavior rather than a documented SLA.

      Parameters

      • bucket: Bucket

        The bucket to search.

      • fileName: string

        Exact file name (path) to look up.

      • OptionalbucketDisplayName: string

        Optional label for the error message; defaults to bucket.name. Used when looking up in a source bucket distinct from the action's destination bucket (cross-bucket copy).

      Returns Promise<FileVersion>