Azure.Storage.Files.DataLake.DataLakeFileClient
The DataLakeFileClient allows you to manipulate Azure Data Lake files.
Gets the maximum number of bytes that can be sent in each append call in
to UploadAsync.
Supported value is now larger than MaxValue; please use
MaxUploadLongBytes.
Gets the maximum number of bytes that can be sent in each append call in
UploadAsync.
protected DataLakeFileClient()
Initializes a new instance of the DataLakeFileClient
class for mocking.
Initializes a new instance of the DataLakeFileClient class.
Initializes a new instance of the DataLakeFileClient class.
Initializes a new instance of the DataLakeDirectoryClient.
public DataLakeFileClient(string connectionString, string fileSystemName, string filePath, DataLakeClientOptions options)
Initializes a new instance of the DataLakeDirectoryClient.
Initializes a new instance of the DataLakeFileClient class.
public DataLakeFileClient(Uri fileUri, StorageSharedKeyCredential credential, DataLakeClientOptions options)
Initializes a new instance of the DataLakeFileClient class.
Initializes a new instance of the DataLakeFileClient class.
public DataLakeFileClient(Uri fileUri, AzureSasCredential credential, DataLakeClientOptions options)
Initializes a new instance of the DataLakeFileClient class.
Initializes a new instance of the DataLakeFileClient class.
Initializes a new instance of the DataLakeFileClient class.
public virtual Response Append(Stream content, long offset, DataLakeFileAppendOptions options = null, CancellationToken cancellationToken = default)
The Append operation uploads data to be appended to a file.
Data can only be appended to a file.
To apply previously uploaded data to a file, call Flush Data.
Append is currently limited to 4000 MB per request. To upload large files all at once, consider using Upload.
For more information, see
Update Path.
public virtual Response Append(Stream content, long offset, byte[] contentHash, string leaseId, IProgress<long> progressHandler, CancellationToken cancellationToken)
The Append operation uploads data to be appended to a file.
Data can only be appended to a file.
To apply previously uploaded data to a file, call Flush Data.
Append is currently limited to 4000 MB per request. To upload large files all at once, consider using Upload.
For more information, see
Update Path.
public virtual Task<Response> AppendAsync(Stream content, long offset, DataLakeFileAppendOptions options = null, CancellationToken cancellationToken = default)
The AppendAsync operation uploads data to be appended to a file. Data can only be appended to a file.
To apply perviously uploaded data to a file, call Flush Data.
Append is currently limited to 4000 MB per request. To upload large files all at once, consider using UploadAsync.
For more information, see
Update Path.
public virtual Task<Response> AppendAsync(Stream content, long offset, byte[] contentHash, string leaseId, IProgress<long> progressHandler, CancellationToken cancellationToken)
The AppendAsync operation uploads data to be appended to a file. Data can only be appended to a file.
To apply perviously uploaded data to a file, call Flush Data.
Append is currently limited to 4000 MB per request. To upload large files all at once, consider using UploadAsync.
For more information, see
Update Path.
public virtual Response<PathInfo> Create(DataLakePathCreateOptions options = null, CancellationToken cancellationToken = default)
The Create operation creates a file.
If the file already exists, it will be overwritten. If you don't intent to overwrite
an existing file, consider using the CreateIfNotExists API.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Response<PathInfo> Create(PathHttpHeaders httpHeaders, IDictionary<string, string> metadata, string permissions, string umask, DataLakeRequestConditions conditions, CancellationToken cancellationToken)
The Create operation creates a file.
If the file already exists, it will be overwritten. If you don't intent to overwrite
an existing file, consider using the CreateIfNotExists API.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Task<Response<PathInfo>> CreateAsync(DataLakePathCreateOptions options = null, CancellationToken cancellationToken = default)
The CreateAsync operation creates a file.
If the file already exists, it will be overwritten. If you don't intent to overwrite
an existing file, consider using the CreateIfNotExistsAsync API.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Task<Response<PathInfo>> CreateAsync(PathHttpHeaders httpHeaders, IDictionary<string, string> metadata, string permissions, string umask, DataLakeRequestConditions conditions, CancellationToken cancellationToken)
The CreateAsync operation creates a file.
If the file already exists, it will be overwritten. If you don't intent to overwrite
an existing file, consider using the CreateIfNotExistsAsync API.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Response<PathInfo> CreateIfNotExists(DataLakePathCreateOptions options = null, CancellationToken cancellationToken = default)
The CreateIfNotExists operation creates a file.
If the file already exists, it is not changed.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Response<PathInfo> CreateIfNotExists(PathHttpHeaders httpHeaders, IDictionary<string, string> metadata, string permissions, string umask, CancellationToken cancellationToken)
The CreateIfNotExists operation creates a file.
If the file already exists, it is not changed.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Task<Response<PathInfo>> CreateIfNotExistsAsync(DataLakePathCreateOptions options = null, CancellationToken cancellationToken = default)
The CreateIfNotExistsAsync operation creates a file.
If the file already exists, it is not changed.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Task<Response<PathInfo>> CreateIfNotExistsAsync(PathHttpHeaders httpHeaders, IDictionary<string, string> metadata, string permissions, string umask, CancellationToken cancellationToken)
The CreateIfNotExistsAsync operation creates a file.
If the file already exists, it is not changed.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Response Delete(DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
The Delete operation marks the specified path
deletion.
For more information, see
Delete Path.
public virtual Task<Response> DeleteAsync(DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
The DeleteAsync operation marks the specified path
deletion.
For more information, see
Delete Path.
public virtual Response<bool> DeleteIfExists(DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
The DeleteIfExists operation marks the specified file
for deletion, if the file exists.
For more information, see
Delete Path.
public virtual Task<Response<bool>> DeleteIfExistsAsync(DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
The DeleteIfExistsAsync operation marks the specified file
for deletion, if the file exists.
For more information, see
Delete Path.
public virtual Response<PathInfo> Flush(long position, DataLakeFileFlushOptions options = null, CancellationToken cancellationToken = default)
The Flush operation flushes (writes) previously
appended data to a file.
public virtual Response<PathInfo> Flush(long position, bool? retainUncommittedData, bool? close, PathHttpHeaders httpHeaders, DataLakeRequestConditions conditions, CancellationToken cancellationToken)
The Flush operation flushes (writes) previously
appended data to a file.
public virtual Task<Response<PathInfo>> FlushAsync(long position, DataLakeFileFlushOptions options = null, CancellationToken cancellationToken = default)
The FlushAsync operation flushes (writes) previously
appended data to a file.
public virtual Task<Response<PathInfo>> FlushAsync(long position, bool? retainUncommittedData, bool? close, PathHttpHeaders httpHeaders, DataLakeRequestConditions conditions, CancellationToken cancellationToken)
The FlushAsync operation flushes (writes) previously
appended data to a file.
public virtual Response<PathProperties> GetProperties(DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
The GetProperties operation returns all
user-defined metadata, standard HTTP properties, and system
properties for the path. It does not return the content of the
path.
For more information, see
Get Properties.
public virtual Stream OpenRead(DataLakeOpenReadOptions options, CancellationToken cancellationToken = default)
Opens a stream for reading from the file. The stream will only download
the file as the stream is read from.
public virtual Stream OpenRead(long position = 0, int? bufferSize = default, DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
Opens a stream for reading from the file. The stream will only download
the file as the stream is read from.
public virtual Stream OpenRead(bool allowfileModifications, long position = 0, int? bufferSize = default, CancellationToken cancellationToken = default)
Opens a stream for reading from the file. The stream will only download
the file as the stream is read from.
public virtual Task<Stream> OpenReadAsync(DataLakeOpenReadOptions options, CancellationToken cancellationToken = default)
Opens a stream for reading from the file. The stream will only download
the file as the stream is read from.
public virtual Task<Stream> OpenReadAsync(long position = 0, int? bufferSize = default, DataLakeRequestConditions conditions = null, CancellationToken cancellationToken = default)
Opens a stream for reading from the file. The stream will only download
the file as the stream is read from.
public virtual Task<Stream> OpenReadAsync(bool allowfileModifications, long position = 0, int? bufferSize = default, CancellationToken cancellationToken = default)
Opens a stream for reading from the file. The stream will only download
the file as the stream is read from.
public virtual Stream OpenWrite(bool overwrite, DataLakeFileOpenWriteOptions options = null, CancellationToken cancellationToken = default)
Opens a stream for writing to the file.
public virtual Task<Stream> OpenWriteAsync(bool overwrite, DataLakeFileOpenWriteOptions options = null, CancellationToken cancellationToken = default)
Opens a stream for writing to the file..
public virtual Response<FileDownloadInfo> Query(string querySqlExpression, DataLakeQueryOptions options = null, CancellationToken cancellationToken = default)
The Query API returns the
result of a query against the file.
public virtual Task<Response<FileDownloadInfo>> QueryAsync(string querySqlExpression, DataLakeQueryOptions options = null, CancellationToken cancellationToken = default)
The Query API returns the
result of a query against the file.
The Read operation downloads a file from
the service, including its metadata and properties.
For more information, see
Get Blob.
The Read operation downloads a file from
the service, including its metadata and properties.
For more information, see
Get Blob.
public virtual Response<FileDownloadInfo> Read(HttpRange range, DataLakeRequestConditions conditions, bool rangeGetContentHash, CancellationToken cancellationToken)
The Read
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Response<FileDownloadInfo> Read(DataLakeFileReadOptions options = null, CancellationToken cancellationToken = default)
The Read
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
The ReadAsync operation downloads a file from
the service, including its metadata and properties.
For more information, see
Get Blob.
public virtual Task<Response<FileDownloadInfo>> ReadAsync(CancellationToken cancellationToken = default)
The ReadAsync operation downloads a file from
the service, including its metadata and properties.
For more information, see
Get Blob.
public virtual Task<Response<FileDownloadInfo>> ReadAsync(HttpRange range, DataLakeRequestConditions conditions, bool rangeGetContentHash, CancellationToken cancellationToken)
The ReadAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Task<Response<FileDownloadInfo>> ReadAsync(DataLakeFileReadOptions options = null, CancellationToken cancellationToken = default)
The ReadAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
The ReadContent
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
The ReadContent
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Response<DataLakeFileReadResult> ReadContent(DataLakeFileReadOptions options, CancellationToken cancellationToken = default)
The ReadContent
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
The ReadContentAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Task<Response<DataLakeFileReadResult>> ReadContentAsync(CancellationToken cancellationToken)
The ReadContentAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Task<Response<DataLakeFileReadResult>> ReadContentAsync(DataLakeFileReadOptions options, CancellationToken cancellationToken = default)
The ReadContentAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
The ReadStreaming
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Response<DataLakeFileReadStreamingResult> ReadStreaming(CancellationToken cancellationToken)
The ReadStreaming
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Response<DataLakeFileReadStreamingResult> ReadStreaming(DataLakeFileReadOptions options, CancellationToken cancellationToken = default)
The ReadStreaming
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
The ReadStreamingAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Task<Response<DataLakeFileReadStreamingResult>> ReadStreamingAsync(CancellationToken cancellationToken)
The ReadStreamingAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Task<Response<DataLakeFileReadStreamingResult>> ReadStreamingAsync(DataLakeFileReadOptions options, CancellationToken cancellationToken = default)
The ReadStreamingAsync
operation downloads a file from the service, including its metadata
and properties.
For more information, see
Get Blob.
public virtual Response ReadTo(Stream destination, DataLakeFileReadToOptions options = null, CancellationToken cancellationToken = default)
The ReadTo
operation downloads an entire file using parallel requests,
and writes the content to the provided stream.
public virtual Response ReadTo(string path, DataLakeFileReadToOptions options = null, CancellationToken cancellationToken = default)
The ReadTo
operation downloads an entire file using parallel requests,
and writes the content to the provided file path.
public virtual Response ReadTo(Stream destination, DataLakeRequestConditions conditions, StorageTransferOptions transferOptions, CancellationToken cancellationToken)
The ReadTo
operation downloads an entire file using parallel requests,
and writes the content to destination.
public virtual Response ReadTo(string path, DataLakeRequestConditions conditions, StorageTransferOptions transferOptions, CancellationToken cancellationToken)
The ReadTo
operation downloads an entire file using parallel requests,
and writes the content to path.
public virtual Task<Response> ReadToAsync(Stream destination, DataLakeFileReadToOptions options = null, CancellationToken cancellationToken = default)
The ReadToAsync
operation downloads an entire file using parallel requests,
and writes the content to the provided destination stream.
public virtual Task<Response> ReadToAsync(string path, DataLakeFileReadToOptions options = null, CancellationToken cancellationToken = default)
The ReadToAsync
operation downloads an entire file using parallel requests,
and writes the content to the provided file path.
public virtual Task<Response> ReadToAsync(Stream destination, DataLakeRequestConditions conditions, StorageTransferOptions transferOptions, CancellationToken cancellationToken)
The ReadToAsync
operation downloads an entire file using parallel requests,
and writes the content to destination.
public virtual Task<Response> ReadToAsync(string path, DataLakeRequestConditions conditions, StorageTransferOptions transferOptions, CancellationToken cancellationToken)
The ReadToAsync
operation downloads an entire file using parallel requests,
and writes the content to path.
public virtual Response<DataLakeFileClient> Rename(string destinationPath, string destinationFileSystem = null, DataLakeRequestConditions sourceConditions = null, DataLakeRequestConditions destinationConditions = null, CancellationToken cancellationToken = default)
The Rename operation renames a Directory.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Task<Response<DataLakeFileClient>> RenameAsync(string destinationPath, string destinationFileSystem = null, DataLakeRequestConditions sourceConditions = null, DataLakeRequestConditions destinationConditions = null, CancellationToken cancellationToken = default)
The RenameAsync operation renames a file or directory.
For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create.
public virtual Response<PathInfo> ScheduleDeletion(DataLakeFileScheduleDeletionOptions options, CancellationToken cancellationToken = default)
Schedules the file for deletion.
public virtual Task<Response<PathInfo>> ScheduleDeletionAsync(DataLakeFileScheduleDeletionOptions options, CancellationToken cancellationToken = default)
Schedules the file for deletion.
public virtual Response<PathInfo> Upload(Stream content, DataLakeFileUploadOptions options, CancellationToken cancellationToken = default)
The Upload
operation creates and uploads content to a file. If the file already exists, its content will be overwritten,
unless otherwise specified in the Conditions or alternatively use
Upload, Upload.
For more information, see
Update Path.
public virtual Response<PathInfo> Upload(Stream content, PathHttpHeaders httpHeaders = null, DataLakeRequestConditions conditions = null, IProgress<long> progressHandler = null, StorageTransferOptions transferOptions = default, CancellationToken cancellationToken = default)
The Upload
operation creates and uploads content to a file. If the file already exists, its content will be overwritten,
unless otherwise specified in the DataLakeRequestConditions or alternatively use
Upload, Upload.
For more information, see .
The Upload
operation creates and uploads content to a file.
If the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Response<PathInfo> Upload(Stream content, bool overwrite = false, CancellationToken cancellationToken = default)
The Upload
operation creates and uploads content to a file.
If the overwrite parameter is not specified and
the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Response<PathInfo> Upload(string path, DataLakeFileUploadOptions options, CancellationToken cancellationToken = default)
The Upload
operation creates and uploads content to a file.If the file already exists, its content will be overwritten,
unless otherwise specified in the Conditions or alternatively use
Upload, Upload.
For more information, see
Update Path.
public virtual Response<PathInfo> Upload(string path, PathHttpHeaders httpHeaders = null, DataLakeRequestConditions conditions = null, IProgress<long> progressHandler = null, StorageTransferOptions transferOptions = default, CancellationToken cancellationToken = default)
The Upload
operation creates and uploads content to a file.If the file already exists, its content will be overwritten,
unless otherwise specified in the DataLakeRequestConditions or alternatively use
Upload, Upload.
For more information, see
Update Path.
The Upload
operation creates and uploads content to a file.
If the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Response<PathInfo> Upload(string path, bool overwrite = false, CancellationToken cancellationToken = default)
The Upload
operation creates and uploads content to a file.
If the overwrite parameter is not specified and
the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Task<Response<PathInfo>> UploadAsync(Stream content, DataLakeFileUploadOptions options, CancellationToken cancellationToken = default)
The UploadAsync
operation creates and uploads content to a file. If the file already exists, its content will be overwritten,
unless otherwise specified in the Conditions or alternatively use
UploadAsync, UploadAsync.
For more information, see
Update Path.
public virtual Task<Response<PathInfo>> UploadAsync(Stream content, PathHttpHeaders httpHeaders = null, DataLakeRequestConditions conditions = null, IProgress<long> progressHandler = null, StorageTransferOptions transferOptions = default, CancellationToken cancellationToken = default)
The UploadAsync
operation creates and uploads content to a file. If the file already exists, its content will be overwritten,
unless otherwise specified in the DataLakeRequestConditions or alternatively use
UploadAsync, UploadAsync.
For more information, see
Update Path.
The UploadAsync
operation creates and uploads content to a file.
If the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Task<Response<PathInfo>> UploadAsync(Stream content, bool overwrite = false, CancellationToken cancellationToken = default)
The UploadAsync
operation creates and uploads content to a file.
If the overwrite parameter is not specified and
the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Task<Response<PathInfo>> UploadAsync(string path, DataLakeFileUploadOptions options, CancellationToken cancellationToken = default)
The UploadAsync
operation creates and uploads content to a file. If the file already exists, its content will be overwritten,
unless otherwise specified in the Conditions or alternatively use
UploadAsync, UploadAsync.
For more information, see
Update Path.
public virtual Task<Response<PathInfo>> UploadAsync(string path, PathHttpHeaders httpHeaders = null, DataLakeRequestConditions conditions = null, IProgress<long> progressHandler = null, StorageTransferOptions transferOptions = default, CancellationToken cancellationToken = default)
The UploadAsync
operation creates and uploads content to a file. If the file already exists, its content will be overwritten,
unless otherwise specified in the DataLakeRequestConditions or alternatively use
Upload, Upload.
For more information, see
Update Path.
The UploadAsync
operation creates and uploads content to a file.
If the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
public virtual Task<Response<PathInfo>> UploadAsync(string path, bool overwrite = false, CancellationToken cancellationToken = default)
The UploadAsync
operation creates and uploads content to a file.
If the overwrite parameter is not specified and
the file already exists, then its content will not be overwritten.
The request will be sent with If-None-Match Header with the value of
the special wildcard. So if the file already exists a
RequestFailedException is expected to be thrown.
For more information, see
Update Path.
Initializes a new instance of the DataLakeFileClient
class with an identical Uri source but the specified
customerProvidedKey.