Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShareFileClient

Package version

A ShareFileClient represents a URL to an Azure Storage file.

export
class

ShareFileClient

Hierarchy

Index

Constructors

constructor

Properties

accountName

accountName: string

Protected storageClientContext

storageClientContext: StorageClientContext

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

type

{StorageClientContext}

memberof

StorageClient

url

url: string

URL string value.

type

{string}

memberof

StorageClient

Accessors

path

  • get path(): string

shareName

  • get shareName(): string

Methods

abortCopyFromURL

clearRange

create

delete

  • Removes the file 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

    memberof

    ShareFileClient

    Parameters

    Returns Promise<FileDeleteResponse>

    Response data for the File Delete operation.

download

  • download(offset?: number, count?: undefined | number, options?: FileDownloadOptions): Promise<FileDownloadResponseModel>

downloadToBuffer

  • ONLY AVAILABLE IN NODE.JS RUNTIME.

    Downloads an Azure file in parallel to a buffer. Offset and count are optional, pass 0 for both to download the entire file.

    Parameters

    • buffer: Buffer

      Buffer to be fill, must have length larger than count

    • Default value offset: number = 0

      From which position of the Azure File to download

    • Optional count: undefined | number
    • Default value options: FileDownloadToBufferOptions = {}

    Returns Promise<void>

downloadToFile

  • downloadToFile(filePath: string, offset?: number, count?: undefined | number, options?: FileDownloadOptions): Promise<FileDownloadResponseModel>
  • ONLY AVAILABLE IN NODE.JS RUNTIME.

    Downloads an Azure Blob to a local file. Fails if the the given file path already exits. Offset and count are optional, pass 0 and undefined respectively to download the entire blob.

    memberof

    BlobClient

    Parameters

    • filePath: string
    • Default value offset: number = 0
    • Optional count: undefined | number
    • Default value options: FileDownloadOptions = {}

    Returns Promise<FileDownloadResponseModel>

    The response data for blob download operation, but with readableStreamBody set to undefined since its content is already read and written into a local file at the specified path.

forceCloseAllHandles

forceCloseHandle

getProperties

getRangeList

listHandles

resize

setHttpHeaders

setMetadata

setProperties

startCopyFromURL

  • Copies a blob or file to a destination file within the storage account.

    memberof

    ShareFileClient

    Parameters

    • copySource: string

      Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source.

    • Default value options: FileStartCopyOptions = {}

    Returns Promise<FileStartCopyResponse>

uploadBrowserData

uploadFile

uploadRange

  • Upload a range of bytes to a file. Both the start and count of the range must be specified. The range can be up to 4 MB in size.

    memberof

    ShareFileClient

    Parameters

    • body: HttpRequestBody

      Blob, string, ArrayBuffer, ArrayBufferView or a function which returns a new Readable stream whose offset is from data source beginning.

    • offset: number

      Offset position of the destination Azure File to upload.

    • contentLength: number

      Length of body in bytes. Use Buffer.byteLength() to calculate body length for a string including non non-Base64/Hex-encoded characters.

    • Default value options: FileUploadRangeOptions = {}

    Returns Promise<FileUploadRangeResponse>

    Response data for the File Upload Range operation.

uploadRangeFromURL

  • Upload a range of bytes to a file where the contents are read from a another file's URL. The range can be up to 4 MB in size.

    memberof

    FileURL

    Parameters

    • sourceURL: string

      Specify a URL to the copy source, Shared Access Signature(SAS) maybe needed for authentication.

    • sourceOffset: number

      The source offset to copy from. Pass 0 to copy from the beginning of source file.

    • destOffset: number

      Offset of destination file.

    • count: number

      Number of bytes to be uploaded from source file.

    • Default value options: FileUploadRangeFromURLOptions = {}

    Returns Promise<FileUploadRangeFromURLResponse>

uploadResetableStream

  • ONLY AVAILABLE IN NODE.JS RUNTIME.

    Accepts a Node.js Readable stream factory, and uploads in blocks to an Azure File. The Readable stream factory must returns a Node.js Readable stream starting from the offset defined. The offset is the offset in the Azure file to be uploaded.

    export

    Parameters

    • streamFactory: function

      Returns a Node.js Readable stream starting from the offset defined

        • (offset: number, count?: undefined | number): ReadableStream
        • Parameters

          • offset: number
          • Optional count: undefined | number

          Returns ReadableStream

    • size: number

      Size of the Azure file

    • Default value options: FileParallelUploadOptions = {}

    Returns Promise<void>

uploadSeekableBlob

  • ONLY AVAILABLE IN BROWSERS.

    Uploads a browser Blob object to an Azure file. Requires a blobFactory as the data source, which need to return a Blob object with the offset and size provided.

    Parameters

    • blobFactory: function
        • (offset: number, size: number): Blob
        • Parameters

          • offset: number
          • size: number

          Returns Blob

    • size: number
    • Default value options: FileParallelUploadOptions = {}

    Returns Promise<void>

uploadStream

  • uploadStream(stream: Readable, size: number, bufferSize: number, maxBuffers: number, options?: FileUploadStreamOptions): Promise<void>
  • ONLY AVAILABLE IN NODE.JS RUNTIME.

    Uploads a Node.js Readable stream into an Azure file. This method will try to create an Azure, then starts uploading chunk by chunk. Size of chunk is defined by bufferSize parameter. Please make sure potential size of stream doesn't exceed file size.

    PERFORMANCE IMPROVEMENT TIPS:

    • Input stream highWaterMark is better to set a same value with bufferSize parameter, which will avoid Buffer.concat() operations.

    Parameters

    • stream: Readable

      Node.js Readable stream. Must be less or equal than file size.

    • size: number

      Size of file to be created. Maxium size allowed is 1TB. If this value is larger than stream size, there will be empty bytes in file tail.

    • bufferSize: number

      Size of every buffer allocated in bytes, also the chunk/range size during the uploaded file. Size must be > 0 and <= 4 * 1024 * 1024 (4MB)

    • maxBuffers: number

      Max buffers will allocate during uploading, positive correlation with max uploading concurrency

    • Default value options: FileUploadStreamOptions = {}

    Returns Promise<void>

Generated using TypeDoc