Share via


AdlsClient.CreateFileAsync Method

Definition

Asynchronous API that creates a file and returns the stream to write data to that file in ADLS. The file is opened with exclusive access - any attempt to open the same file for append will fail while this stream is open.

Threading: The returned stream is not thread-safe.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.DataLake.Store.AdlsOutputStream> CreateFileAsync (string filename, Microsoft.Azure.DataLake.Store.IfExists mode, string octalPermission = default, bool createParent = true, System.Threading.CancellationToken cancelToken = default);
abstract member CreateFileAsync : string * Microsoft.Azure.DataLake.Store.IfExists * string * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.DataLake.Store.AdlsOutputStream>
override this.CreateFileAsync : string * Microsoft.Azure.DataLake.Store.IfExists * string * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.DataLake.Store.AdlsOutputStream>
Public Overridable Function CreateFileAsync (filename As String, mode As IfExists, Optional octalPermission As String = Nothing, Optional createParent As Boolean = true, Optional cancelToken As CancellationToken = Nothing) As Task(Of AdlsOutputStream)

Parameters

filename
String

File name

mode
IfExists

Overwrites the existing file if the mode is Overwrite

octalPermission
String

Octal permission string, can be null

createParent
Boolean

If true creates any non-existing parent directories

cancelToken
CancellationToken

CancellationToken to cancel the request

Returns

Output stream

Applies to