DataLakePathClient class

A DataLakePathClient represents a URL to the Azure Storage path (directory or file).

Extends

StorageClient

Constructors

DataLakePathClient(string, Pipeline)

Creates an instance of DataLakePathClient from url and pipeline.

DataLakePathClient(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(PathResourceTypeModel, PathCreateOptions)

Create a directory or path.

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

createIfNotExists(PathResourceTypeModel, PathCreateIfNotExistsOptions)

Create a directory or file. If the resource already exists, it is not changed.

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

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

DataLakePathClient(string, Pipeline)

Creates an instance of DataLakePathClient from url and pipeline.

new DataLakePathClient(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.

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

Creates an instance of DataLakePathClient from url and credential.

new DataLakePathClient(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 StorageClient.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 StorageClient.credential

url

Encoded URL string value.

url: string

Property Value

string

Inherited From StorageClient.url

Method Details

create(PathResourceTypeModel, PathCreateOptions)

Create a directory or path.

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, "directory" or "file".

options
PathCreateOptions

Optional. Options when creating path.

Returns

createIfNotExists(PathResourceTypeModel, PathCreateIfNotExistsOptions)

Create a directory or file. If the resource already exists, it is not changed.

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, "directory" or "file".

Returns

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

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

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>

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

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

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

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>

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>

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

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

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

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

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

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

toDirectoryClient()

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

function toDirectoryClient(): DataLakeDirectoryClient

Returns

toFileClient()

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

function toFileClient(): DataLakeFileClient

Returns

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