ShareFileClient class
ShareFileClient 代表 Azure 記憶體檔案的 URL。
- Extends
-
StorageClient
建構函式
Share |
建立 ShareFileClient 的實例。 |
Share |
建立 ShareFileClient 的實例。 |
屬性
name | 檔名 |
path | 檔案的完整路徑 |
share |
對應至此檔案用戶端的共享名稱 |
繼承的屬性
account |
|
url | URL 字串值。 |
方法
建構函式詳細資料
ShareFileClient(string, Credential_2 | TokenCredential, ShareClientOptions)
建立 ShareFileClient 的實例。
new ShareFileClient(url: string, credential?: Credential_2 | TokenCredential, options?: ShareClientOptions)
參數
- url
-
string
指向 Azure 記憶體檔案的 URL 字串,例如 「https://myaccount.file.core.windows.net/myshare/mydirectory/file"。 如果使用 AnonymousCredential,則可以附加 SAS,例如 “https://myaccount.file.core.windows.net/myshare/mydirectory/file?sasString"。 此方法接受指向檔案的編碼 URL 或非編碼 URL。 編碼的 URL 字串不會逸出兩次,只會逸出 URL 路徑中的特殊字元。 不過,如果檔案或目錄名稱包含 %,則必須在URL中編碼檔案或目錄名稱。 例如名為 「myfile%」 的檔案,URL 應該是 「https://myaccount.file.core.windows.net/myshare/mydirectory/myfile%25"。
- credential
例如 ,StorageSharedKeyCredential 或 TokenCredential,如果未指定,則會使用 AnonymousCredential。
- options
- ShareClientOptions
自選。 設定 HTTP 管線的選項。
ShareFileClient(string, Pipeline, ShareClientConfig)
建立 ShareFileClient 的實例。
new ShareFileClient(url: string, pipeline: Pipeline, options?: ShareClientConfig)
參數
- url
-
string
指向 Azure 記憶體檔案的 URL 字串,例如 「https://myaccount.file.core.windows.net/myshare/mydirectory/file"。 如果使用 AnonymousCredential,則可以附加 SAS,例如 “https://myaccount.file.core.windows.net/myshare/mydirectory/file?sasString"。 此方法接受指向檔案的編碼 URL 或非編碼 URL。 編碼的 URL 字串不會逸出兩次,只會逸出 URL 路徑中的特殊字元。 不過,如果檔案或目錄名稱包含 %,則必須在URL中編碼檔案或目錄名稱。 例如名為 「myfile%」 的檔案,URL 應該是 「https://myaccount.file.core.windows.net/myshare/mydirectory/myfile%25"。
- pipeline
- Pipeline
呼叫 newPipeline() 以建立預設管線,或提供自定義管線。
- options
- ShareClientConfig
屬性詳細資料
name
檔名
string name
屬性值
string
path
檔案的完整路徑
string path
屬性值
string
shareName
對應至此檔案用戶端的共享名稱
string shareName
屬性值
string
繼承的屬性詳細資料
accountName
accountName: string
屬性值
string
繼承自 StorageClient.accountName
url
URL 字串值。
url: string
屬性值
string
繼承自 StorageClient.url
方法詳細資料
abortCopyFromURL(string, FileAbortCopyFromURLOptions)
中止暫止的複製文件作業,並保留長度為零和完整元數據的目的地檔案。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/abort-copy-file
function abortCopyFromURL(copyId: string, options?: FileAbortCopyFromURLOptions): Promise<FileAbortCopyResponse>
參數
- copyId
-
string
要中止之複製檔案作業的標識碼。
- options
- FileAbortCopyFromURLOptions
檔案中止複製 URL 作業的選項。
傳回
Promise<FileAbortCopyResponse>
clearRange(number, number, FileClearRangeOptions)
清除指定的範圍,並釋放該範圍儲存空間。
function clearRange(offset: number, contentLength: number, options?: FileClearRangeOptions): Promise<FileUploadRangeResponse>
參數
- offset
-
number
- contentLength
-
number
- options
- FileClearRangeOptions
檔案清除範圍作業的選項。
傳回
Promise<FileUploadRangeResponse>
create(number, FileCreateOptions)
建立新的檔案或取代檔案。 請注意,它只會初始化沒有內容的檔案。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/create-file
function create(size: number, options?: FileCreateOptions): Promise<FileCreateResponse>
參數
- size
-
number
指定檔案的大小上限,最多為 4 TB。
- options
- FileCreateOptions
檔案建立作業的選項。
傳回
Promise<FileCreateResponse>
檔案建立作業的響應數據。
範例用法:
const content = "Hello world!";
// Create the file
await fileClient.create(content.length);
console.log("Created file successfully!");
// Then upload data to the file
await fileClient.uploadRange(content, 0, content.length);
console.log("Updated file successfully!")
createHardLink(string, FileCreateHardLinkOptions)
僅限 NFS。 建立路徑所指定檔案的硬式連結。
function createHardLink(targetFile: string, options?: FileCreateHardLinkOptions): Promise<FileCreateHardLinkResponse>
參數
- targetFile
-
string
要建立硬式連結的檔案路徑,不包括共用。 例如:“targetDirectory/targetSubDirectory/.../targetFile”
- options
- FileCreateHardLinkOptions
建立硬式連結作業的選項。
傳回
Promise<FileCreateHardLinkResponse>
delete(FileDeleteOptions)
從記憶體帳戶移除檔案。 成功刪除檔案時,它會立即從記憶體帳戶的索引中移除,且客戶端無法再存取。 檔案的數據稍後會在垃圾收集期間從服務中移除。
如果檔案在SMB用戶端上開啟,刪除檔案將會失敗,狀態代碼為409(衝突)和錯誤碼SharingViolation。
共用快照集不支援刪除檔案,這是共用的唯讀複本。 嘗試在共用快照集上執行這項作業將會失敗,並產生 400 (InvalidQueryParameterValue)
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/delete-file2
function delete(options?: FileDeleteOptions): Promise<FileDeleteResponse>
參數
- options
- FileDeleteOptions
檔案刪除作業的選項。
傳回
Promise<FileDeleteResponse>
檔案刪除作業的回應數據。
deleteIfExists(FileDeleteOptions)
如果檔案存在,則會從記憶體帳戶中移除該檔案。 成功刪除檔案時,它會立即從記憶體帳戶的索引中移除,且客戶端無法再存取。 檔案的數據稍後會在垃圾收集期間從服務中移除。
如果檔案在SMB用戶端上開啟,刪除檔案將會失敗,狀態代碼為409(衝突)和錯誤碼SharingViolation。
共用快照集不支援刪除檔案,這是共用的唯讀複本。 嘗試在共用快照集上執行這項作業將會失敗,並產生 400 (InvalidQueryParameterValue)
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/delete-file2
function deleteIfExists(options?: FileDeleteOptions): Promise<FileDeleteIfExistsResponse>
參數
- options
- FileDeleteOptions
傳回
Promise<FileDeleteIfExistsResponse>
download(number, number, FileDownloadOptions)
從系統讀取或下載檔案,包括其元數據和屬性。
- 在 Node.js中,數據會在可讀取數據流中傳回
readableStreamBody
- 在瀏覽器中,數據會以 promise
contentAsBlob
傳回
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/get-file
function download(offset?: number, count?: number, options?: FileDownloadOptions): Promise<FileDownloadResponseModel>
參數
- offset
-
number
要下載的檔案位置,大於或等於 0
- count
-
number
要下載的數據量,大於0。 將在未定義時下載至結尾
- options
- FileDownloadOptions
檔案下載作業的選項。
傳回
Promise<FileDownloadResponseModel>
檔案下載作業的回應數據。
範例使用方式 (Node.js):
// Download a file to a string
const downloadFileResponse = await fileClient.download();
console.log(
"Downloaded file content:",
(await streamToBuffer(downloadFileResponse.readableStreamBody)).toString()}
);
// A helper method used to read a Node.js readable stream into string
async function streamToBuffer(readableStream) {
return new Promise((resolve, reject) => {
const chunks = [];
readableStream.on("data", (data) => {
chunks.push(typeof data === "string" ? Buffer.from(data) : data);
});
readableStream.on("end", () => {
resolve(Buffer.concat(chunks));
});
readableStream.on("error", reject);
});
}
範例使用方式(瀏覽器):
// Download a file to a string
const downloadFileResponse = await fileClient.download(0);
console.log(
"Downloaded file content:",
await blobToString(await downloadFileResponse.blobBody)}
);
// A helper method used to convert a browser Blob into string.
export async function blobToString(blob: Blob): Promise<string> {
const fileReader = new FileReader();
return new Promise<string>((resolve, reject) => {
fileReader.onloadend = (ev: any) => {
resolve(ev.target!.result);
};
fileReader.onerror = reject;
fileReader.readAsText(blob);
});
}
downloadToBuffer(Buffer, number, number, FileDownloadToBufferOptions)
僅適用於運行時間NODE.JS。
平行下載 Azure 檔案至緩衝區。 位移和計數是選擇性的,兩者都傳遞 0 以下載整個檔案。
警告:緩衝區只能在32位系統上支援最多一 GB 的檔案,或64位系統上最多支援大約2 GB的檔案,因為 Node.js/V8的限制。 對於大於此大小的檔案,請考慮 downloadToFile。
function downloadToBuffer(buffer: Buffer, offset?: number, count?: number, options?: FileDownloadToBufferOptions): Promise<Buffer>
參數
- buffer
-
Buffer
要填滿的緩衝區,長度必須大於計數
- offset
-
number
要下載的 Azure 檔案位置
- count
-
number
要下載的數據量。 會在傳遞未定義時下載至結尾
- options
- FileDownloadToBufferOptions
傳回
Promise<Buffer>
downloadToBuffer(number, number, FileDownloadToBufferOptions)
僅適用於運行時間NODE.JS
平行下載 Azure 檔案至緩衝區。 位移和計數是選擇性的,兩者都傳遞 0 以下載整個檔案
警告:緩衝區只能在32位系統上支援最多一 GB 的檔案,或64位系統上最多支援大約2 GB的檔案,因為 Node.js/V8的限制。 對於大於此大小的檔案,請考慮 downloadToFile。
function downloadToBuffer(offset?: number, count?: number, options?: FileDownloadToBufferOptions): Promise<Buffer>
參數
- offset
-
number
要下載的 Azure 檔案位置
- count
-
number
要下載的數據量。 會在傳遞未定義時下載至結尾
- options
- FileDownloadToBufferOptions
傳回
Promise<Buffer>
downloadToFile(string, number, number, FileDownloadOptions)
僅適用於運行時間NODE.JS。
將 Azure Blob 下載至本機檔案。 如果指定的檔案路徑已經結束,就會失敗。 位移和計數是選擇性的,分別傳遞 0 和未定義,以下載整個 Blob。
function downloadToFile(filePath: string, offset?: number, count?: number, options?: FileDownloadOptions): Promise<FileDownloadResponseModel>
參數
- filePath
-
string
- offset
-
number
要下載的區塊 Blob 位置。
- count
-
number
要下載的數據量。 會在傳遞未定義時下載至結尾。
- options
- FileDownloadOptions
Blob 下載選項的選項。
傳回
Promise<FileDownloadResponseModel>
Blob 下載作業的響應數據,但已將可讀取StreamBody 設定為未定義,因為其內容已經讀取並寫入指定路徑的本機檔案中。
exists(FileExistsOptions)
如果指定的檔案存在,則傳回 true;否則為 false。
注意:請小心使用此函式,因為其他用戶端或應用程式可能會刪除現有的檔案。 反之亦然,此函式完成之後,其他用戶端或應用程式可能會新增新的檔案。
function exists(options?: FileExistsOptions): Promise<boolean>
參數
- options
- FileExistsOptions
[存在] 作業的選項。
傳回
Promise<boolean>
forceCloseAllHandles(FileForceCloseHandlesOptions)
強制關閉檔案的所有句柄。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
function forceCloseAllHandles(options?: FileForceCloseHandlesOptions): Promise<CloseHandlesInfo>
參數
- options
- FileForceCloseHandlesOptions
強制關閉句柄作業的選項。
傳回
Promise<CloseHandlesInfo>
forceCloseHandle(string, FileForceCloseHandlesOptions)
強制關閉檔案的特定句柄。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/force-close-handles
function forceCloseHandle(handleId: string, options?: FileForceCloseHandlesOptions): Promise<FileForceCloseHandlesResponse>
參數
- handleId
-
string
特定句柄標識碼,不能是星號 “*”。 使用 forceCloseAllHandles() 關閉所有句柄。
- options
- FileForceCloseHandlesOptions
傳回
Promise<FileForceCloseHandlesResponse>
generateSasStringToSign(FileGenerateSasUrlOptions)
僅適用於使用共用金鑰認證建構的用戶端。
根據傳入的用戶端屬性和參數,產生字串以簽署服務共用存取簽章 (SAS) URI。 SAS 是由客戶端的共用金鑰認證所簽署。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
function generateSasStringToSign(options: FileGenerateSasUrlOptions): string
參數
- options
- FileGenerateSasUrlOptions
選擇性參數。
傳回
string
由此用戶端所代表資源的 URI 所組成的 SAS URI,後面接著產生的 SAS 令牌。
generateSasUrl(FileGenerateSasUrlOptions)
僅適用於使用共用金鑰認證建構的用戶端。
根據傳入的用戶端屬性和參數,產生服務共用存取簽章 (SAS) URI。 SAS 是由客戶端的共用金鑰認證所簽署。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
function generateSasUrl(options: FileGenerateSasUrlOptions): string
參數
- options
- FileGenerateSasUrlOptions
選擇性參數。
傳回
string
由此用戶端所代表資源的 URI 所組成的 SAS URI,後面接著產生的 SAS 令牌。
getProperties(FileGetPropertiesOptions)
傳回檔案的所有使用者定義元數據、標準 HTTP 屬性和系統屬性。 它不會傳回檔案的內容。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/get-file-properties
function getProperties(options?: FileGetPropertiesOptions): Promise<FileGetPropertiesResponse>
參數
- options
- FileGetPropertiesOptions
檔案取得屬性作業的選項。
傳回
Promise<FileGetPropertiesResponse>
檔案取得屬性作業的響應數據。
getRangeList(FileGetRangeListOptions)
傳回檔案的有效範圍清單。
function getRangeList(options?: FileGetRangeListOptions): Promise<FileGetRangeListResponse>
參數
- options
- FileGetRangeListOptions
[檔案取得範圍清單] 作業的選項。
傳回
Promise<FileGetRangeListResponse>
getRangeListDiff(string, FileGetRangeListOptions)
傳回先前共用快照集與這個檔案之間不同的範圍清單。
function getRangeListDiff(prevShareSnapshot: string, options?: FileGetRangeListOptions): Promise<FileGetRangeListDiffResponse>
參數
- prevShareSnapshot
-
string
先前的快照集參數是不透明的 DateTime 值,可指定要比較的上一個共用快照集。
- options
- FileGetRangeListOptions
傳回
Promise<FileGetRangeListDiffResponse>
getShareLeaseClient(string)
取得管理檔案租用的 ShareLeaseClient。
function getShareLeaseClient(proposeLeaseId?: string): ShareLeaseClient
參數
- proposeLeaseId
-
string
初始建議的租用標識碼。
傳回
用於管理檔案租用的新 ShareLeaseClient 物件。
listHandles(FileListHandlesOptions)
傳回異步反覆運算器以列出所有句柄。 在指定的帳戶下。
.byPage() 會傳回異步反覆運算器,以列出頁面中的句柄。
function listHandles(options?: FileListHandlesOptions): PagedAsyncIterableIterator<HandleItem, FileListHandlesResponse, PageSettings>
參數
傳回
rename(string, FileRenameOptions)
重新命名檔案。 此 API 僅支援在相同共用中重新命名檔案。
function rename(destinationPath: string, options?: FileRenameOptions): Promise<{ destinationFileClient: ShareFileClient, fileRenameResponse: FileRenameResponse }>
參數
- destinationPath
-
string
指定要重新命名的目標路徑。 路徑會經過編碼,以放入URL以指定目的地。
- options
- FileRenameOptions
重新命名作業的選項。
傳回
Promise<{ destinationFileClient: ShareFileClient, fileRenameResponse: FileRenameResponse }>
檔案重新命名作業的響應數據。
範例用法:
// Rename the file
await fileClient.rename(destinationPath);
console.log("Renamed file successfully!");
resize(number, FileResizeOptions)
調整檔案大小。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-properties
function resize(length: number, options?: FileResizeOptions): Promise<FileSetHTTPHeadersResponse>
參數
- length
-
number
將檔案大小調整為以位元組為單位的指定大小。 如果指定的位元組值小於檔案的目前大小,則會清除指定位元組值上方的所有範圍。
- options
- FileResizeOptions
檔案重設大小作業的選項。
傳回
Promise<FileSetHTTPHeadersResponse>
檔案集 HTTP 標頭作業的響應數據。
setHttpHeaders(FileHttpHeaders, FileSetHttpHeadersOptions)
設定檔案上的 HTTP 標頭。
如果未提供任何選項,或選項中未提供檔案 HTTP 標頭的值,則會清除沒有值的這些檔案 HTTP 標頭。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-properties
function setHttpHeaders(fileHttpHeaders?: FileHttpHeaders, options?: FileSetHttpHeadersOptions): Promise<FileSetHTTPHeadersResponse>
參數
- fileHttpHeaders
- FileHttpHeaders
- options
- FileSetHttpHeadersOptions
檔案集 HTTP 標頭作業的選項。
傳回
Promise<FileSetHTTPHeadersResponse>
檔案集 HTTP 標頭作業的響應數據。
setMetadata(Metadata, FileSetMetadataOptions)
更新指定檔案的使用者定義元數據。
如果未在option參數中定義任何元數據,則會移除檔案元數據。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-metadata
function setMetadata(metadata?: Metadata, options?: FileSetMetadataOptions): Promise<FileSetMetadataResponse>
參數
- metadata
- Metadata
如果未提供任何元數據,則會移除所有現有的目錄元數據
- options
- FileSetMetadataOptions
檔案集元數據作業的選項。
傳回
Promise<FileSetMetadataResponse>
檔案集元數據作業的響應數據。
setProperties(FileProperties)
設定檔案上的屬性。
請參閱 https://learn.microsoft.com/en-us/rest/api/storageservices/set-file-properties
function setProperties(properties?: FileProperties): Promise<SetPropertiesResponse>
參數
- properties
- FileProperties
檔案屬性。 對於檔案 HTTP 標頭(例如 Content-Type),如果未提供任何值,則會移除現有的 HTTP 標頭。 針對其他檔案屬性(例如 fileAttributes),如果未提供任何值,則會保留現有的值。
傳回
Promise<SetPropertiesResponse>
startCopyFromURL(string, FileStartCopyOptions)
將 Blob 或檔案複製到記憶體帳戶內的目的地檔案。
function startCopyFromURL(copySource: string, options?: FileStartCopyOptions): Promise<FileStartCopyResponse>
參數
- copySource
-
string
指定來源檔案或 Blob 的 URL,長度最多 2 KB。 若要將檔案複製到相同儲存體帳戶內的另一個檔案,您可以使用共用密鑰來驗證來源檔案。 如果您要從另一個記憶體帳戶複製檔案,或是從相同的記憶體帳戶或其他記憶體帳戶複製 Blob,則必須使用共用存取簽章來驗證來源檔案或 Blob。 如果來源是公用 Blob,則不需要驗證即可執行複製作業。 共用快照集中的檔案也可以指定為複製來源。
- options
- FileStartCopyOptions
[檔案開始複製] 作業的選項。
傳回
Promise<FileStartCopyResponse>
uploadData(Blob | ArrayBuffer | ArrayBufferView | Buffer, FileParallelUploadOptions)
建立新的 Azure 檔案或取代現有的 Azure 檔案,然後將 Buffer(Node)/Blob/ArrayBuffer/ArrayBufferView 上傳至該檔案。
function uploadData(data: Blob | ArrayBuffer | ArrayBufferView | Buffer, options?: FileParallelUploadOptions): Promise<void>
參數
- data
-
Blob | ArrayBuffer | ArrayBufferView | Buffer
Buffer(Node)、Blob、ArrayBuffer 或 ArrayBufferView
- options
- FileParallelUploadOptions
傳回
Promise<void>
uploadFile(string, FileParallelUploadOptions)
僅適用於運行時間NODE.JS。
建立新的 Azure 檔案或取代現有的 Azure 檔案,然後將本機檔案上傳至該檔案。
function uploadFile(filePath: string, options?: FileParallelUploadOptions): Promise<void>
參數
- filePath
-
string
本機檔案的完整路徑
- options
- FileParallelUploadOptions
傳回
Promise<void>
uploadRange(RequestBodyType, number, number, FileUploadRangeOptions)
將位元組範圍上傳至檔案。 此作業只能在現有的檔案上呼叫。 它不會變更檔案的大小、屬性或元數據。 必須指定範圍的開始和計數。 此範圍的大小上限為 4 MB。
function uploadRange(body: RequestBodyType, offset: number, contentLength: number, options?: FileUploadRangeOptions): Promise<FileUploadRangeResponse>
參數
- body
- HttpRequestBody
Blob、字串、ArrayBuffer、ArrayBufferView 或函式,會傳回新的可讀取數據流,其位移從數據源開始。
- offset
-
number
要上傳之目的地 Azure 檔案的位置位移。
- contentLength
-
number
以位元組為單位的主體長度。 使用 Buffer.byteLength() 來計算字串串的主體長度,包括非 Base64/Hex 編碼字元。
- options
- FileUploadRangeOptions
檔案上傳範圍作業的選項。
傳回
Promise<FileUploadRangeResponse>
檔案上傳範圍作業的響應數據。
範例用法:
const content = "Hello world!";
// Create the file
await fileClient.create(content.length);
console.log("Created file successfully!");
// Then upload data to the file
await fileClient.uploadRange(content, 0, content.length);
console.log("Updated file successfully!")
uploadRangeFromURL(string, number, number, number, FileUploadRangeFromURLOptions)
將位元組範圍上傳至從另一個檔案的 URL 讀取內容的檔案。 此範圍的大小上限為 4 MB。
function uploadRangeFromURL(sourceURL: string, sourceOffset: number, destOffset: number, count: number, options?: FileUploadRangeFromURLOptions): Promise<FileUploadRangeFromURLResponse>
參數
- sourceURL
-
string
指定複製來源的 URL,可能需要共用存取簽章(SAS)才能進行驗證。
- sourceOffset
-
number
要複製的來源位移。 傳遞 0 以從原始程式檔開頭複製。
- destOffset
-
number
目的地檔案的位移。
- count
-
number
要從原始程式檔上傳的位元組數目。
- options
- FileUploadRangeFromURLOptions
配置檔案的選項 - 從 URL 作業上傳範圍。
傳回
Promise<FileUploadRangeFromURLResponse>
uploadResetableStream((offset: number, count?: number) => ReadableStream, number, FileParallelUploadOptions)
僅適用於運行時間NODE.JS。
接受 Node.js 可讀取的數據流處理站,並將區塊上傳至 Azure 檔案。 可讀取數據流處理站必須從定義的位移傳回 Node.js 可讀取數據流。 位移是要上傳之 Azure 檔案中的位移。
function uploadResetableStream(streamFactory: (offset: number, count?: number) => ReadableStream, size: number, options?: FileParallelUploadOptions): Promise<void>
參數
- streamFactory
-
(offset: number, count?: number) => ReadableStream
從定義的位移開始傳回 Node.js 可讀取數據流
- size
-
number
Azure 檔案的大小
- options
- FileParallelUploadOptions
傳回
Promise<void>
uploadSeekableBlob((offset: number, size: number) => Blob, number, FileParallelUploadOptions)
僅適用於瀏覽器。
將瀏覽器 Blob 物件上傳至 Azure 檔案。 需要 blobFactory 做為數據源,而該數據源需要傳回具有所提供位移和大小的 Blob 物件。
function uploadSeekableBlob(blobFactory: (offset: number, size: number) => Blob, size: number, options?: FileParallelUploadOptions): Promise<void>
參數
- blobFactory
-
(offset: number, size: number) => Blob
- size
-
number
- options
- FileParallelUploadOptions
傳回
Promise<void>
uploadStream(Readable, number, number, number, FileUploadStreamOptions)
僅適用於運行時間NODE.JS。
建立新的 Azure 檔案或取代現有的 Azure 檔案,然後將 Node.js 可讀取數據流上傳至其中。
此方法會嘗試建立 Azure 檔案,然後依區塊開始上傳區塊。
區塊的大小是由 bufferSize
參數所定義。
請確定數據流的潛在大小不會超過檔案大小。
效能改進秘訣:
- 輸入數據流 highWaterMark 最好使用 bufferSize 參數設定相同的值,以避免 Buffer.concat() 作業。
function uploadStream(stream: Readable, size: number, bufferSize: number, maxBuffers: number, options?: FileUploadStreamOptions): Promise<void>
參數
- stream
-
Readable
Node.js 可讀取數據流。 必須小於或等於檔案大小。
- size
-
number
要建立的檔案大小。 允許的大小上限為 4 TB。 如果這個值大於數據流大小,檔案結尾中將會有空的位元組。
- bufferSize
-
number
每個以位元組配置的緩衝區大小,也是上傳的檔案期間區塊/範圍大小。 大小必須大於 0 且小於或等於 4 * 1024 * 1024 (4MB)
- maxBuffers
-
number
最大緩衝區會在上傳期間配置,與上傳並行上限的正相互關聯
- options
- FileUploadStreamOptions
傳回
Promise<void>
withShareSnapshot(string)
建立與來源相同的新 ShareFileClient 物件,但具有指定的共用快照集時間戳。 提供 “” 會移除快照集,並將 URL 傳回基底 ShareFileClient。
function withShareSnapshot(shareSnapshot: string): ShareFileClient
參數
- shareSnapshot
-
string
共用快照集時間戳。
傳回
新的 ShareFileClient 對象與來源相同,但具有指定的共用快照集時間戳。