DataLakeDirectoryClient class

A DataLakeDirectoryClient represents a URL to the Azure Storage directory.

Extends

Constructors

DataLakeDirectoryClient(string, Pipeline)

Creates an instance of DataLakePathClient from url and pipeline.

DataLakeDirectoryClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)

Creates an instance of DataLakePathClient from url and credential.

Properties

fileSystemName

Name of current file system.

name

Name of current path (directory or file).

Inherited Properties

accountName
credential

Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.

url

Encoded URL string value.

Methods

create(DirectoryCreateOptions)

Create a directory.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

create(PathResourceTypeModel, PathCreateOptions)

Create a directory.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

createIfNotExists(DirectoryCreateIfNotExistsOptions)

Create a directory if it doesn't already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

createIfNotExists(PathResourceTypeModel, PathCreateIfNotExistsOptions)

Create a directory if it doesn't already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

generateSasStringToSign(DirectoryGenerateSasUrlOptions)

Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

generateSasUrl(DirectoryGenerateSasUrlOptions)

Only available for clients constructed with a shared key credential.

Generates a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

generateUserDelegationSasStringToSign(DirectoryGenerateSasUrlOptions, UserDelegationKey)

Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in The SAS is signed by the input user delegation key.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

generateUserDelegationSasUrl(DirectoryGenerateSasUrlOptions, UserDelegationKey)

Generates a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in. The SAS is signed by the input user delegation key.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

getFileClient(string)

Creates a DataLakeFileClient object under current directory.

getSubdirectoryClient(string)

Creates a DataLakeDirectoryClient object under current directory.

Inherited Methods

delete(boolean, PathDeleteOptions)

Delete current path (directory or file).

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete

deleteIfExists(boolean, PathDeleteOptions)

Delete current path (directory or file) if it exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete

exists(PathExistsOptions)

Returns true if the Data Lake file represented by this client exists; false otherwise.

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

getAccessControl(PathGetAccessControlOptions)

Returns the access control data for a path (directory of file).

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/getproperties

getDataLakeLeaseClient(string)

Get a DataLakeLeaseClient that manages leases on the path (directory or file).

getProperties(PathGetPropertiesOptions)

Returns all user-defined metadata, standard HTTP properties, and system properties for the path (directory or file).

WARNING: The metadata object returned in the response will have its keys in lowercase, even if they originally contained uppercase characters. This differs from the metadata keys returned by the methods of DataLakeFileSystemClient that list paths using the includeMetadata option, which will retain their original casing.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties

move(string, PathMoveOptions)

Move directory or file within same file system.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

move(string, string, PathMoveOptions)

Move directory or file to another file system.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

removeAccessControlRecursive(RemovePathAccessControlItem[], PathChangeAccessControlRecursiveOptions)

Removes the Access Control on a path and sub paths.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

setAccessControl(PathAccessControlItem[], PathSetAccessControlOptions)

Set the access control data for a path (directory of file).

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

setAccessControlRecursive(PathAccessControlItem[], PathChangeAccessControlRecursiveOptions)

Sets the Access Control on a path and sub paths.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

setHttpHeaders(PathHttpHeaders, PathSetHttpHeadersOptions)

Sets system properties on the path (directory or file).

If no value provided, or no value provided for the specified blob HTTP headers, these blob HTTP headers without a value will be cleared.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties

setMetadata(Metadata, PathSetMetadataOptions)

Sets user-defined metadata for the specified path (directory of file) as one or more name-value pairs.

If no option provided, or no metadata defined in the parameter, the path metadata will be removed.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata

setPermissions(PathPermissions, PathSetPermissionsOptions)

Sets the file permissions on a path.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

toDirectoryClient()

Convert current DataLakePathClient to DataLakeDirectoryClient if current path is a directory.

toFileClient()

Convert current DataLakePathClient to DataLakeFileClient if current path is a file.

updateAccessControlRecursive(PathAccessControlItem[], PathChangeAccessControlRecursiveOptions)

Modifies the Access Control on a path and sub paths.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

Constructor Details

DataLakeDirectoryClient(string, Pipeline)

Creates an instance of DataLakePathClient from url and pipeline.

new DataLakeDirectoryClient(url: string, pipeline: Pipeline)

Parameters

url

string

A Client string pointing to Azure Storage data lake path (directory or file), such as "https://myaccount.dfs.core.windows.net/filesystem/directory" or "https://myaccount.dfs.core.windows.net/filesystem/file". You can append a SAS if using AnonymousCredential, such as "https://myaccount.dfs.core.windows.net/filesystem/directory?sasString".

pipeline
Pipeline

Call newPipeline() to create a default pipeline, or provide a customized pipeline.

DataLakeDirectoryClient(string, StorageSharedKeyCredential | AnonymousCredential | TokenCredential, StoragePipelineOptions)

Creates an instance of DataLakePathClient from url and credential.

new DataLakeDirectoryClient(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)

Parameters

url

string

A Client string pointing to Azure Storage data lake path (directory or file), such as "https://myaccount.dfs.core.windows.net/filesystem/directory" or "https://myaccount.dfs.core.windows.net/filesystem/file". You can append a SAS if using AnonymousCredential, such as "https://myaccount.dfs.core.windows.net/filesystem/directory?sasString".

credential

StorageSharedKeyCredential | AnonymousCredential | TokenCredential

Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.

options
StoragePipelineOptions

Optional. Options to configure the HTTP pipeline.

Property Details

fileSystemName

Name of current file system.

string fileSystemName

Property Value

string

name

Name of current path (directory or file).

string name

Property Value

string

Inherited Property Details

accountName

accountName: string

Property Value

string

Inherited From DataLakePathClient.accountName

credential

Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the @azure/identity package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.

credential: StorageSharedKeyCredential | AnonymousCredential | TokenCredential

Property Value

Inherited From DataLakePathClient.credential

url

Encoded URL string value.

url: string

Property Value

string

Inherited From DataLakePathClient.url

Method Details

create(DirectoryCreateOptions)

Create a directory.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

function create(options?: DirectoryCreateOptions): Promise<DirectoryCreateResponse>

Parameters

options
DirectoryCreateOptions

Optional. Options when creating directory.

Returns

create(PathResourceTypeModel, PathCreateOptions)

Create a directory.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

function create(resourceType: PathResourceTypeModel, options?: PathCreateOptions): Promise<PathCreateResponse>

Parameters

resourceType
PathResourceTypeModel

Resource type, must be "directory" for DataLakeDirectoryClient.

options
PathCreateOptions

Optional. Options when creating directory.

Returns

createIfNotExists(DirectoryCreateIfNotExistsOptions)

Create a directory if it doesn't already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

function createIfNotExists(options?: DirectoryCreateIfNotExistsOptions): Promise<DirectoryCreateIfNotExistsResponse>

Parameters

Returns

createIfNotExists(PathResourceTypeModel, PathCreateIfNotExistsOptions)

Create a directory if it doesn't already exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

function createIfNotExists(resourceType: PathResourceTypeModel, options?: PathCreateIfNotExistsOptions): Promise<PathCreateIfNotExistsResponse>

Parameters

resourceType
PathResourceTypeModel

Resource type, must be "directory" for DataLakeDirectoryClient.

Returns

generateSasStringToSign(DirectoryGenerateSasUrlOptions)

Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

function generateSasStringToSign(options: DirectoryGenerateSasUrlOptions): string

Parameters

options
DirectoryGenerateSasUrlOptions

Optional parameters.

Returns

string

The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.

generateSasUrl(DirectoryGenerateSasUrlOptions)

Only available for clients constructed with a shared key credential.

Generates a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

function generateSasUrl(options: DirectoryGenerateSasUrlOptions): Promise<string>

Parameters

options
DirectoryGenerateSasUrlOptions

Optional parameters.

Returns

Promise<string>

The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.

generateUserDelegationSasStringToSign(DirectoryGenerateSasUrlOptions, UserDelegationKey)

Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in The SAS is signed by the input user delegation key.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

function generateUserDelegationSasStringToSign(options: DirectoryGenerateSasUrlOptions, userDelegationKey: UserDelegationKey): string

Parameters

options
DirectoryGenerateSasUrlOptions

Optional parameters.

userDelegationKey
UserDelegationKey

Return value of blobServiceClient.getUserDelegationKey()

Returns

string

The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.

generateUserDelegationSasUrl(DirectoryGenerateSasUrlOptions, UserDelegationKey)

Generates a Service Shared Access Signature (SAS) URI based on the client properties and parameters passed in. The SAS is signed by the input user delegation key.

See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas

function generateUserDelegationSasUrl(options: DirectoryGenerateSasUrlOptions, userDelegationKey: UserDelegationKey): Promise<string>

Parameters

options
DirectoryGenerateSasUrlOptions

Optional parameters.

userDelegationKey
UserDelegationKey

Return value of blobServiceClient.getUserDelegationKey()

Returns

Promise<string>

The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.

getFileClient(string)

Creates a DataLakeFileClient object under current directory.

function getFileClient(fileName: string): DataLakeFileClient

Parameters

fileName

string

Returns

getSubdirectoryClient(string)

Creates a DataLakeDirectoryClient object under current directory.

function getSubdirectoryClient(subdirectoryName: string): DataLakeDirectoryClient

Parameters

subdirectoryName

string

Subdirectory name.

Returns

Inherited Method Details

delete(boolean, PathDeleteOptions)

Delete current path (directory or file).

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete

function delete(recursive?: boolean, options?: PathDeleteOptions): Promise<PathDeleteResponse>

Parameters

recursive

boolean

Required and valid only when the resource is a directory. If "true", all paths beneath the directory will be deleted.

options
PathDeleteOptions

Optional. Options when deleting path.

Returns

Inherited From DataLakePathClient.delete

deleteIfExists(boolean, PathDeleteOptions)

Delete current path (directory or file) if it exists.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete

function deleteIfExists(recursive?: boolean, options?: PathDeleteOptions): Promise<PathDeleteIfExistsResponse>

Parameters

recursive

boolean

Required and valid only when the resource is a directory. If "true", all paths beneath the directory will be deleted.

Returns

Inherited From DataLakePathClient.deleteIfExists

exists(PathExistsOptions)

Returns true if the Data Lake file represented by this client exists; false otherwise.

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

function exists(options?: PathExistsOptions): Promise<boolean>

Parameters

options
PathExistsOptions

options to Exists operation.

Returns

Promise<boolean>

Inherited From DataLakePathClient.exists

getAccessControl(PathGetAccessControlOptions)

Returns the access control data for a path (directory of file).

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/getproperties

function getAccessControl(options?: PathGetAccessControlOptions): Promise<PathGetAccessControlResponse>

Parameters

options
PathGetAccessControlOptions

Optional. Options when getting file access control.

Returns

Inherited From DataLakePathClient.getAccessControl

getDataLakeLeaseClient(string)

Get a DataLakeLeaseClient that manages leases on the path (directory or file).

function getDataLakeLeaseClient(proposeLeaseId?: string): DataLakeLeaseClient

Parameters

proposeLeaseId

string

Optional. Initial proposed lease Id.

Returns

Inherited From DataLakePathClient.getDataLakeLeaseClient

getProperties(PathGetPropertiesOptions)

Returns all user-defined metadata, standard HTTP properties, and system properties for the path (directory or file).

WARNING: The metadata object returned in the response will have its keys in lowercase, even if they originally contained uppercase characters. This differs from the metadata keys returned by the methods of DataLakeFileSystemClient that list paths using the includeMetadata option, which will retain their original casing.

See https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties

function getProperties(options?: PathGetPropertiesOptions): Promise<PathGetPropertiesResponse>

Parameters

options
PathGetPropertiesOptions

Optional. Options when getting path properties.

Returns

Inherited From DataLakePathClient.getProperties

move(string, PathMoveOptions)

Move directory or file within same file system.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

function move(destinationPath: string, options?: PathMoveOptions): Promise<PathMoveResponse>

Parameters

destinationPath

string

Destination directory path like "directory" or file path "directory/file". If the destinationPath is authenticated with SAS, add the SAS to the destination path like "directory/file?sasToken".

options
PathMoveOptions

Optional. Options when moving directory or file.

Returns

Promise<PathMoveResponse>

Inherited From DataLakePathClient.move

move(string, string, PathMoveOptions)

Move directory or file to another file system.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create

function move(destinationFileSystem: string, destinationPath: string, options?: PathMoveOptions): Promise<PathMoveResponse>

Parameters

destinationFileSystem

string

Destination file system like "filesystem".

destinationPath

string

Destination directory path like "directory" or file path "directory/file" If the destinationPath is authenticated with SAS, add the SAS to the destination path like "directory/file?sasToken".

options
PathMoveOptions

Optional. Options when moving directory or file.

Returns

Promise<PathMoveResponse>

Inherited From DataLakePathClient.move

removeAccessControlRecursive(RemovePathAccessControlItem[], PathChangeAccessControlRecursiveOptions)

Removes the Access Control on a path and sub paths.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

function removeAccessControlRecursive(acl: RemovePathAccessControlItem[], options?: PathChangeAccessControlRecursiveOptions): Promise<PathChangeAccessControlRecursiveResponse>

Parameters

acl

RemovePathAccessControlItem[]

The POSIX access control list for the file or directory.

options
PathChangeAccessControlRecursiveOptions

Optional. Options

Returns

Inherited From DataLakePathClient.removeAccessControlRecursive

setAccessControl(PathAccessControlItem[], PathSetAccessControlOptions)

Set the access control data for a path (directory of file).

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

function setAccessControl(acl: PathAccessControlItem[], options?: PathSetAccessControlOptions): Promise<PathSetAccessControlResponse>

Parameters

acl

PathAccessControlItem[]

The POSIX access control list for the file or directory.

options
PathSetAccessControlOptions

Optional. Options when setting path access control.

Returns

Inherited From DataLakePathClient.setAccessControl

setAccessControlRecursive(PathAccessControlItem[], PathChangeAccessControlRecursiveOptions)

Sets the Access Control on a path and sub paths.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

function setAccessControlRecursive(acl: PathAccessControlItem[], options?: PathChangeAccessControlRecursiveOptions): Promise<PathChangeAccessControlRecursiveResponse>

Parameters

acl

PathAccessControlItem[]

The POSIX access control list for the file or directory.

options
PathChangeAccessControlRecursiveOptions

Optional. Options

Returns

Inherited From DataLakePathClient.setAccessControlRecursive

setHttpHeaders(PathHttpHeaders, PathSetHttpHeadersOptions)

Sets system properties on the path (directory or file).

If no value provided, or no value provided for the specified blob HTTP headers, these blob HTTP headers without a value will be cleared.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-properties

function setHttpHeaders(httpHeaders: PathHttpHeaders, options?: PathSetHttpHeadersOptions): Promise<PathSetHttpHeadersResponse>

Parameters

httpHeaders
PathHttpHeaders

Returns

Inherited From DataLakePathClient.setHttpHeaders

setMetadata(Metadata, PathSetMetadataOptions)

Sets user-defined metadata for the specified path (directory of file) as one or more name-value pairs.

If no option provided, or no metadata defined in the parameter, the path metadata will be removed.

See https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-metadata

function setMetadata(metadata?: Metadata, options?: PathSetMetadataOptions): Promise<PathSetMetadataResponse>

Parameters

metadata
Metadata

Optional. Replace existing metadata with this value. If no value provided the existing metadata will be removed.

options
PathSetMetadataOptions

Optional. Options when setting path metadata.

Returns

Inherited From DataLakePathClient.setMetadata

setPermissions(PathPermissions, PathSetPermissionsOptions)

Sets the file permissions on a path.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

function setPermissions(permissions: PathPermissions, options?: PathSetPermissionsOptions): Promise<PathSetPermissionsResponse>

Parameters

permissions
PathPermissions

The POSIX access permissions for the file owner, the file owning group, and others.

options
PathSetPermissionsOptions

Optional. Options when setting path permissions.

Returns

Inherited From DataLakePathClient.setPermissions

toDirectoryClient()

Convert current DataLakePathClient to DataLakeDirectoryClient if current path is a directory.

function toDirectoryClient(): DataLakeDirectoryClient

Returns

Inherited From DataLakePathClient.toDirectoryClient

toFileClient()

Convert current DataLakePathClient to DataLakeFileClient if current path is a file.

function toFileClient(): DataLakeFileClient

Returns

Inherited From DataLakePathClient.toFileClient

updateAccessControlRecursive(PathAccessControlItem[], PathChangeAccessControlRecursiveOptions)

Modifies the Access Control on a path and sub paths.

See https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/update

function updateAccessControlRecursive(acl: PathAccessControlItem[], options?: PathChangeAccessControlRecursiveOptions): Promise<PathChangeAccessControlRecursiveResponse>

Parameters

acl

PathAccessControlItem[]

The POSIX access control list for the file or directory.

options
PathChangeAccessControlRecursiveOptions

Optional. Options

Returns

Inherited From DataLakePathClient.updateAccessControlRecursive