Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShareClient

Package version

A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.

Hierarchy

Index

Constructors

constructor

Properties

accountName

accountName: string

Protected credential

credential: Credential

Credential in the pipleline to authenticate requests to the service, such as AnonymousCredential, StorageSharedKeyCredential. Initialized to an AnonymousCredential if not able to retrieve it from the pipeline.

internal

Protected pipeline

pipeline: Pipeline

Request policy pipeline.

internal

Protected storageClientContext

storageClientContext: StorageClientContext

StorageClient is a reference to protocol layer operations entry, which is generated by AutoRest generator.

url

url: string

URL string value.

Accessors

name

  • get name(): string

rootDirectoryClient

  • Gets the directory client for the root directory of this share. Note that the root directory always exists and cannot be deleted.

    readonly

    A new ShareDirectoryClient object for the root directory.

    Returns ShareDirectoryClient

Methods

create

createDirectory

createFile

createIfNotExists

createPermission

createSnapshot

delete

deleteDirectory

deleteFile

  • Removes a file under the root directory of this share from the storage account. When a file is successfully deleted, it is immediately removed from the storage account's index and is no longer accessible to clients. The file's data is later removed from the service during garbage collection.

    Delete File will fail with status code 409 (Conflict) and error code SharingViolation if the file is open on an SMB client.

    Delete File is not supported on a share snapshot, which is a read-only copy of a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)

    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/delete-file2

    Parameters

    • fileName: string

      -

    • Default value options: FileDeleteOptions = {}

      Options to File Delete operation.

    Returns Promise<FileDeleteResponse>

    Promise File Delete response data.

deleteIfExists

exists

  • Returns true if the Azrue share resource represented by this client exists; false otherwise.

    NOTE: use this function with care since an existing share might be deleted by other clients or applications. Vice versa new shares might be added by other clients or applications after this function completes.

    Parameters

    Returns Promise<boolean>

generateSasUrl

getAccessPolicy

getDirectoryClient

getPermission

getProperties

getStatistics

setAccessPolicy

  • Sets the permissions for the specified share. The permissions indicate whether directories or files in a share may be accessed publicly.

    When you set permissions for a share, the existing permissions are replaced. If no shareAcl provided, the existing share ACL will be removed.

    When you establish a stored access policy on a share, it may take up to 30 seconds to take effect. During this interval, a shared access signature that is associated with the stored access policy will fail with status code 403 (Forbidden), until the access policy becomes active.

    see

    https://docs.microsoft.com/en-us/rest/api/storageservices/set-share-acl

    Parameters

    • Optional shareAcl: SignedIdentifier[]

      Array of signed identifiers, each having a unique Id and details of access policy.

    • Default value options: ShareSetAccessPolicyOptions = {}

    Returns Promise<ShareSetAccessPolicyResponse>

    Response data for the Share Set Access Policy operation.

setMetadata

setProperties

setQuota

withSnapshot

  • Creates a new ShareClient object identical to the source but with the specified snapshot timestamp. Provide "" will remove the snapshot and return a URL to the base share.

    Parameters

    • snapshot: string

      The snapshot timestamp.

    Returns ShareClient

    A new ShareClient object identical to the source but with the specified snapshot timestamp

Generated using TypeDoc