ShareDirectoryClient class
ShareDirectoryClient představuje adresu URL adresáře služby Azure Storage, který umožňuje manipulovat s jeho soubory a adresáři.
- Extends
-
StorageClient
Konstruktory
| Share |
Vytvoří instanci DirectoryClient. |
| Share |
Vytvoří instanci DirectoryClient. |
Vlastnosti
| name | Název adresáře |
| path | Úplná cesta k adresáři |
| share |
Název sdílené složky odpovídající tomuto klientovi adresáře |
Zděděné vlastnosti
| account |
|
| url | Hodnota řetězce adresy URL. |
Metody
| create(Directory |
Vytvoří nový adresář pod zadanou sdílenou složkou nebo nadřazeným adresářem. Viz https://learn.microsoft.com/rest/api/storageservices/create-directory |
| create |
Vytvoří nový soubor nebo nahradí soubor v tomto adresáři. Všimněte si, že inicializuje pouze soubor bez obsahu. Viz https://learn.microsoft.com/rest/api/storageservices/create-file |
| create |
Vytvoří nový adresář pod zadanou sdílenou složkou nebo nadřazeným adresářem, pokud ještě neexistuje. Pokud adresář již existuje, není změněn. Viz https://learn.microsoft.com/rest/api/storageservices/create-directory |
| create |
Vytvoří v tomto adresáři nový podadresář. Viz https://learn.microsoft.com/rest/api/storageservices/create-directory |
| delete(Directory |
Odebere zadaný prázdný adresář. Před odstraněním adresáře musí být adresář prázdný. Viz https://learn.microsoft.com/rest/api/storageservices/delete-directory |
| delete |
Odebere zadaný soubor v tomto adresáři z účtu úložiště. Když se soubor úspěšně odstraní, okamžitě se odebere z indexu účtu úložiště a už není přístupný pro klienty. Data souboru se později ze služby během uvolňování paměti odeberou. Odstranění souboru selže se stavovým kódem 409 (Konflikt) a kód chyby SharingViolation, pokud je soubor otevřený v klientovi SMB. Odstranění souboru není podporováno na snímku sdílené složky, což je kopie sdílené složky jen pro čtení. Pokus o provedení této operace na snímku sdílené složky selže se 400 (InvalidQueryParameterValue) Viz https://learn.microsoft.com/rest/api/storageservices/delete-file2 |
| delete |
Odebere zadaný prázdný adresář, pokud existuje. Před odstraněním adresáře musí být adresář prázdný. Viz https://learn.microsoft.com/rest/api/storageservices/delete-directory |
| delete |
Odebere zadaný prázdný podadresáři v tomto adresáři. Před odstraněním adresáře musí být adresář prázdný. Viz https://learn.microsoft.com/rest/api/storageservices/delete-directory |
| exists(Directory |
Vrátí hodnotu true, pokud zadaný adresář existuje; jinak nepravda. POZNÁMKA: Tuto funkci používejte opatrně, protože existující adresář může být odstraněn jinými klienty nebo aplikacemi. Po dokončení této funkce mohou být nové adresáře přidány jinými klienty nebo aplikacemi. |
| force |
Vynutit zavření všech popisovačů pro adresář. Viz https://learn.microsoft.com/rest/api/storageservices/force-close-handles |
| force |
Vynuťte zavření určitého popisovače pro adresář. Viz https://learn.microsoft.com/rest/api/storageservices/force-close-handles |
| get |
Vytvoří objekt ShareDirectoryClient pro podadresář. |
| get |
Vytvoří objekt ShareFileClient. |
| get |
Vrátí všechny systémové vlastnosti pro zadaný adresář a lze jej použít také ke kontrole existence adresáře. Vrácená data neobsahují soubory v adresáři ani žádné podadresáře. Viz https://learn.microsoft.com/rest/api/storageservices/get-directory-properties |
| list |
Vrátí asynchronní iterátor pro výpis všech souborů a adresářů v rámci zadaného účtu. .byPage() vrátí asynchronní iterátor pro výpis souborů a adresářů na stránkách. Příklad použití syntaxe
Příklad použití
Příklad použití
Příklad použití stránkování se značkou:
|
| list |
Vrátí asynchronní iterátor, který zobrazí seznam všech popisovačů. pod zadaným účtem. .byPage() vrátí asynchronní iterátor pro výpis popisovačů na stránkách. Příklad použití syntaxe
Příklad použití
Příklad použití
Příklad použití stránkování se značkou:
|
| rename(string, Directory |
Přejmenuje adresář. Toto rozhraní API podporuje přejmenování adresáře pouze ve stejné sdílené složce. |
| set |
Aktualizuje uživatelsky definovaná metadata pro zadaný adresář. Viz https://learn.microsoft.com/rest/api/storageservices/set-directory-metadata |
| set |
Nastaví vlastnosti v adresáři. Viz https://learn.microsoft.com/rest/api/storageservices/set-directory-properties |
Podrobnosti konstruktoru
ShareDirectoryClient(string, Credential | TokenCredential, ShareClientOptions)
Vytvoří instanci DirectoryClient.
new ShareDirectoryClient(url: string, credential?: Credential | TokenCredential, options?: ShareClientOptions)
Parametry
- url
-
string
Řetězec adresy URL odkazující na adresář souborů služby Azure Storage, například "https://myaccount.file.core.windows.net/myshare/mydirectory". Sas můžete připojit, pokud používáte AnonymousCredential, například "https://myaccount.file.core.windows.net/myshare/mydirectory?sasString". Tato metoda přijímá zakódovanou adresu URL nebo nekódovanou adresu URL odkazující na adresář. Kódovaný řetězec adresy URL nebude uchvácen dvakrát, pouze speciální znaky v cestě URL budou uchvácené. Pokud však název adresáře obsahuje %, musí být název adresáře kódován v adrese URL. Například adresář s názvem "mydir%", adresa URL by měla být "https://myaccount.file.core.windows.net/myshare/mydir%25".
- credential
Například AnonymousCredential nebo StorageSharedKeyCredential. Pokud není zadáno, použije se anonymnícredential.
- options
- ShareClientOptions
Optional. Možnosti konfigurace kanálu HTTP
ShareDirectoryClient(string, Pipeline, ShareClientConfig)
Vytvoří instanci DirectoryClient.
new ShareDirectoryClient(url: string, pipeline: Pipeline, options?: ShareClientConfig)
Parametry
- url
-
string
Řetězec adresy URL odkazující na adresář souborů služby Azure Storage, například "https://myaccount.file.core.windows.net/myshare/mydirectory". Sas můžete připojit, pokud používáte AnonymousCredential, například "https://myaccount.file.core.windows.net/myshare/mydirectory?sasString". Tato metoda přijímá zakódovanou adresu URL nebo nekódovanou adresu URL odkazující na adresář. Kódovaný řetězec adresy URL nebude uchvácen dvakrát, pouze speciální znaky v cestě URL budou uchvácené. Pokud však název adresáře obsahuje %, musí být název adresáře kódován v adrese URL. Například adresář s názvem "mydir%", adresa URL by měla být "https://myaccount.file.core.windows.net/myshare/mydir%25".
- pipeline
- Pipeline
Voláním metody newPipeline() vytvořte výchozí kanál nebo zadejte přizpůsobený kanál.
- options
- ShareClientConfig
Podrobnosti vlastnosti
name
Název adresáře
string name
Hodnota vlastnosti
string
path
Úplná cesta k adresáři
string path
Hodnota vlastnosti
string
shareName
Název sdílené složky odpovídající tomuto klientovi adresáře
string shareName
Hodnota vlastnosti
string
Podrobnosti zděděných vlastností
accountName
accountName: string
Hodnota vlastnosti
string
zděděno ze StorageClient.accountName
url
Hodnota řetězce adresy URL.
url: string
Hodnota vlastnosti
string
zděděno ze StorageClient.url
Podrobnosti metody
create(DirectoryCreateOptions)
Vytvoří nový adresář pod zadanou sdílenou složkou nebo nadřazeným adresářem.
Viz https://learn.microsoft.com/rest/api/storageservices/create-directory
function create(options?: DirectoryCreateOptions): Promise<DirectoryCreateResponse>
Parametry
- options
- DirectoryCreateOptions
Možnosti operace vytvoření adresáře
Návraty
Promise<DirectoryCreateResponse>
Data odpovědí pro operaci adresáře.
createFile(string, number, FileCreateOptions)
Vytvoří nový soubor nebo nahradí soubor v tomto adresáři. Všimněte si, že inicializuje pouze soubor bez obsahu.
Viz https://learn.microsoft.com/rest/api/storageservices/create-file
function createFile(fileName: string, size: number, options?: FileCreateOptions): Promise<{ fileClient: ShareFileClient, fileCreateResponse: FileCreateResponse }>
Parametry
- fileName
-
string
- size
-
number
Určuje maximální velikost v bajtech souboru až do 4 TB.
- options
- FileCreateOptions
Možnosti operace Vytvoření souboru
Návraty
Promise<{ fileClient: ShareFileClient, fileCreateResponse: FileCreateResponse }>
Data odpovědi na vytvoření souboru a odpovídající klient souborů.
createIfNotExists(DirectoryCreateOptions)
Vytvoří nový adresář pod zadanou sdílenou složkou nebo nadřazeným adresářem, pokud ještě neexistuje. Pokud adresář již existuje, není změněn.
Viz https://learn.microsoft.com/rest/api/storageservices/create-directory
function createIfNotExists(options?: DirectoryCreateOptions): Promise<DirectoryCreateIfNotExistsResponse>
Parametry
- options
- DirectoryCreateOptions
Návraty
Promise<DirectoryCreateIfNotExistsResponse>
createSubdirectory(string, DirectoryCreateOptions)
Vytvoří v tomto adresáři nový podadresář.
Viz https://learn.microsoft.com/rest/api/storageservices/create-directory
function createSubdirectory(directoryName: string, options?: DirectoryCreateOptions): Promise<{ directoryClient: ShareDirectoryClient, directoryCreateResponse: DirectoryCreateResponse }>
Parametry
- directoryName
-
string
- options
- DirectoryCreateOptions
Možnosti operace vytvoření adresáře
Návraty
Promise<{ directoryClient: ShareDirectoryClient, directoryCreateResponse: DirectoryCreateResponse }>
Adresář vytvoří data odpovědi a odpovídající instanci DirectoryClient.
delete(DirectoryDeleteOptions)
Odebere zadaný prázdný adresář. Před odstraněním adresáře musí být adresář prázdný.
Viz https://learn.microsoft.com/rest/api/storageservices/delete-directory
function delete(options?: DirectoryDeleteOptions): Promise<DirectoryDeleteResponse>
Parametry
- options
- DirectoryDeleteOptions
Možnosti operace odstranění adresáře
Návraty
Promise<DirectoryDeleteResponse>
Data odpovědí pro operaci Odstranění adresáře.
deleteFile(string, FileDeleteOptions)
Odebere zadaný soubor v tomto adresáři z účtu úložiště. Když se soubor úspěšně odstraní, okamžitě se odebere z indexu účtu úložiště a už není přístupný pro klienty. Data souboru se později ze služby během uvolňování paměti odeberou.
Odstranění souboru selže se stavovým kódem 409 (Konflikt) a kód chyby SharingViolation, pokud je soubor otevřený v klientovi SMB.
Odstranění souboru není podporováno na snímku sdílené složky, což je kopie sdílené složky jen pro čtení. Pokus o provedení této operace na snímku sdílené složky selže se 400 (InvalidQueryParameterValue)
Viz https://learn.microsoft.com/rest/api/storageservices/delete-file2
function deleteFile(fileName: string, options?: FileDeleteOptions): Promise<FileDeleteResponse>
Parametry
- fileName
-
string
Název souboru, který chcete odstranit
- options
- FileDeleteOptions
Možnosti operace odstranění souboru
Návraty
Promise<FileDeleteResponse>
Data odpovědi na odstranění souboru.
deleteIfExists(DirectoryDeleteOptions)
Odebere zadaný prázdný adresář, pokud existuje. Před odstraněním adresáře musí být adresář prázdný.
Viz https://learn.microsoft.com/rest/api/storageservices/delete-directory
function deleteIfExists(options?: DirectoryDeleteOptions): Promise<DirectoryDeleteIfExistsResponse>
Parametry
- options
- DirectoryDeleteOptions
Návraty
Promise<DirectoryDeleteIfExistsResponse>
deleteSubdirectory(string, DirectoryDeleteOptions)
Odebere zadaný prázdný podadresáři v tomto adresáři. Před odstraněním adresáře musí být adresář prázdný.
Viz https://learn.microsoft.com/rest/api/storageservices/delete-directory
function deleteSubdirectory(directoryName: string, options?: DirectoryDeleteOptions): Promise<DirectoryDeleteResponse>
Parametry
- directoryName
-
string
- options
- DirectoryDeleteOptions
Možnosti operace odstranění adresáře
Návraty
Promise<DirectoryDeleteResponse>
Data odpovědi na odstranění adresáře
exists(DirectoryExistsOptions)
Vrátí hodnotu true, pokud zadaný adresář existuje; jinak nepravda.
POZNÁMKA: Tuto funkci používejte opatrně, protože existující adresář může být odstraněn jinými klienty nebo aplikacemi. Po dokončení této funkce mohou být nové adresáře přidány jinými klienty nebo aplikacemi.
function exists(options?: DirectoryExistsOptions): Promise<boolean>
Parametry
- options
- DirectoryExistsOptions
možnosti pro operaci Existuje.
Návraty
Promise<boolean>
forceCloseAllHandles(DirectoryForceCloseHandlesSegmentOptions)
Vynutit zavření všech popisovačů pro adresář.
Viz https://learn.microsoft.com/rest/api/storageservices/force-close-handles
function forceCloseAllHandles(options?: DirectoryForceCloseHandlesSegmentOptions): Promise<CloseHandlesInfo>
Parametry
Návraty
Promise<CloseHandlesInfo>
forceCloseHandle(string, DirectoryForceCloseHandlesOptions)
Vynuťte zavření určitého popisovače pro adresář.
Viz https://learn.microsoft.com/rest/api/storageservices/force-close-handles
function forceCloseHandle(handleId: string, options?: DirectoryForceCloseHandlesOptions): Promise<DirectoryForceCloseHandlesResponse>
Parametry
- handleId
-
string
Konkrétní ID popisovače nemůže být hvězdička "*". Pomocí forceCloseHandlesSegment() zavřete všechny popisovače.
Návraty
Promise<DirectoryForceCloseHandlesResponse>
getDirectoryClient(string)
Vytvoří objekt ShareDirectoryClient pro podadresář.
function getDirectoryClient(subDirectoryName: string): ShareDirectoryClient
Parametry
- subDirectoryName
-
string
Název podadresáře
Návraty
Objekt ShareDirectoryClient pro daný název podadresáře.
Příklad použití:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const shareClient = serviceClient.getShareClient(shareName);
const directoryClient = shareClient.getDirectoryClient(directoryName);
await directoryClient.create();
getFileClient(string)
Vytvoří objekt ShareFileClient.
function getFileClient(fileName: string): ShareFileClient
Parametry
- fileName
-
string
Název souboru.
Návraty
Nový objekt ShareFileClient pro daný název souboru.
Příklad použití:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
const content = "Hello World!";
const fileName = `newdirectory${+new Date()}`;
const fileClient = directoryClient.getFileClient(fileName);
await fileClient.create(content.length);
console.log(`Create file ${fileName} successfully`);
// Upload file range
await fileClient.uploadRange(content, 0, content.length);
console.log(`Upload file range "${content}" to ${fileName} successfully`);
getProperties(DirectoryGetPropertiesOptions)
Vrátí všechny systémové vlastnosti pro zadaný adresář a lze jej použít také ke kontrole existence adresáře. Vrácená data neobsahují soubory v adresáři ani žádné podadresáře.
Viz https://learn.microsoft.com/rest/api/storageservices/get-directory-properties
function getProperties(options?: DirectoryGetPropertiesOptions): Promise<DirectoryGetPropertiesResponse>
Parametry
- options
- DirectoryGetPropertiesOptions
Možnosti operace Získání vlastností adresáře
Návraty
Promise<DirectoryGetPropertiesResponse>
Data odpovědí pro operaci Získat vlastnosti adresáře
listFilesAndDirectories(DirectoryListFilesAndDirectoriesOptions)
Vrátí asynchronní iterátor pro výpis všech souborů a adresářů v rámci zadaného účtu.
.byPage() vrátí asynchronní iterátor pro výpis souborů a adresářů na stránkách.
Příklad použití syntaxe for await:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
let i = 1;
for await (const item of directoryClient.listFilesAndDirectories()) {
if (item.kind === "directory") {
console.log(`${i} - directory\t: ${item.name}`);
} else {
console.log(`${i} - file\t: ${item.name}`);
}
i++;
}
Příklad použití iter.next():
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
let i = 1;
const iter = directoryClient.listFilesAndDirectories();
let { value, done } = await iter.next();
while (!done) {
if (value.kind === "directory") {
console.log(`${i} - directory\t: ${value.name}`);
} else {
console.log(`${i} - file\t: ${value.name}`);
}
({ value, done } = await iter.next());
i++;
}
Příklad použití byPage():
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
let i = 1;
for await (const response of directoryClient
.listFilesAndDirectories()
.byPage({ maxPageSize: 20 })) {
console.log(`Page ${i++}:`);
for (const item of response.segment.directoryItems) {
console.log(`\tdirectory: ${item.name}`);
}
for (const item of response.segment.fileItems) {
console.log(`\tfile: ${item.name}`);
}
}
Příklad použití stránkování se značkou:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
let iterator = directoryClient.listFilesAndDirectories().byPage({ maxPageSize: 2 });
let response = (await iterator.next()).value;
for await (const item of response.segment.directoryItems) {
console.log(`\tdirectory: ${item.name}`);
}
for await (const item of response.segment.fileItems) {
console.log(`\tfile: ${item.name}`);
}
// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
iterator = directoryClient
.listFilesAndDirectories()
.byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await iterator.next()).value;
for await (const item of response.segment.directoryItems) {
console.log(`\tdirectory: ${item.name}`);
}
for await (const item of response.segment.fileItems) {
console.log(`\tfile: ${item.name}`);
}
function listFilesAndDirectories(options?: DirectoryListFilesAndDirectoriesOptions): PagedAsyncIterableIterator<({ kind: "file" } & FileItem) | ({ kind: "directory" } & DirectoryItem), DirectoryListFilesAndDirectoriesSegmentResponse, PageSettings>
Parametry
Možnosti zobrazení seznamu souborů a adresářů
Návraty
PagedAsyncIterableIterator<({ kind: "file" } & FileItem) | ({ kind: "directory" } & DirectoryItem), DirectoryListFilesAndDirectoriesSegmentResponse, PageSettings>
AsyncIterableIterator, který podporuje stránkování.
listHandles(DirectoryListHandlesOptions)
Vrátí asynchronní iterátor, který zobrazí seznam všech popisovačů. pod zadaným účtem.
.byPage() vrátí asynchronní iterátor pro výpis popisovačů na stránkách.
Příklad použití syntaxe for await:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
for await (const handle of directoryClient.listHandles()) {
console.log(`Handle: ${handle.handleId}`);
}
Příklad použití iter.next():
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
const handleIter = directoryClient.listHandles();
let { value, done } = await handleIter.next();
while (!done) {
console.log(`Handle: ${value.handleId}`);
({ value, done } = await handleIter.next());
}
Příklad použití byPage():
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
let i = 1;
for await (const response of directoryClient.listHandles().byPage({ maxPageSize: 20 })) {
console.log(`Page ${i++}:`);
for (const handle of response.handleList || []) {
console.log(`\thandle: ${handle.handleId}`);
}
}
Příklad použití stránkování se značkou:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
let iterator = directoryClient.listHandles().byPage({ maxPageSize: 2 });
let response = (await iterator.next()).value;
for await (const handle of response.handleList || []) {
console.log(`\thandle: ${handle.handleId}`);
}
// Gets next marker
let marker = response.continuationToken;
// Passing next marker as continuationToken
iterator = directoryClient.listHandles().byPage({ continuationToken: marker, maxPageSize: 10 });
response = (await iterator.next()).value;
for await (const handle of response.handleList || []) {
console.log(`\thandle: ${handle.handleId}`);
}
function listHandles(options?: DirectoryListHandlesOptions): PagedAsyncIterableIterator<HandleItem, DirectoryListHandlesResponse, PageSettings>
Parametry
- options
- DirectoryListHandlesOptions
Možnosti operací zpracování seznamu
AsyncIterableIterator, který podporuje stránkování.
Návraty
rename(string, DirectoryRenameOptions)
Přejmenuje adresář. Toto rozhraní API podporuje přejmenování adresáře pouze ve stejné sdílené složce.
function rename(destinationPath: string, options?: DirectoryRenameOptions): Promise<{ destinationDirectoryClient: ShareDirectoryClient, directoryRenameResponse: DirectoryRenameResponse }>
Parametry
- destinationPath
-
string
Určuje cílovou cestu, na kterou se má přejmenovat. Cesta se zakóduje tak, aby se do adresy URL zadal cíl.
- options
- DirectoryRenameOptions
Možnosti operace přejmenování
Návraty
Promise<{ destinationDirectoryClient: ShareDirectoryClient, directoryRenameResponse: DirectoryRenameResponse }>
Data odpovědi pro operaci přejmenování souboru.
Příklad použití:
import { StorageSharedKeyCredential, ShareServiceClient } from "@azure/storage-file-share";
const account = "<account>";
const accountKey = "<accountkey>";
const credential = new StorageSharedKeyCredential(account, accountKey);
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
credential,
);
const shareName = "<share name>";
const directoryName = "<directory name>";
const destinationPath = "<destination path>";
const directoryClient = serviceClient.getShareClient(shareName).getDirectoryClient(directoryName);
await directoryClient.rename(destinationPath);
setMetadata(Metadata, DirectorySetMetadataOptions)
Aktualizuje uživatelsky definovaná metadata pro zadaný adresář.
Viz https://learn.microsoft.com/rest/api/storageservices/set-directory-metadata
function setMetadata(metadata?: Metadata, options?: DirectorySetMetadataOptions): Promise<DirectorySetMetadataResponse>
Parametry
- metadata
- Metadata
Pokud nejsou k dispozici žádná metadata, odeberou se všechna existující metadata adresáře.
- options
- DirectorySetMetadataOptions
Možnosti operace nastavení metadat adresáře
Návraty
Promise<DirectorySetMetadataResponse>
Data odpovědí pro operaci metadat sady adresářů.
setProperties(DirectoryProperties)
Nastaví vlastnosti v adresáři.
Viz https://learn.microsoft.com/rest/api/storageservices/set-directory-properties
function setProperties(properties?: DirectoryProperties): Promise<DirectorySetPropertiesResponse>
Parametry
- properties
- DirectoryProperties
Návraty
Promise<DirectorySetPropertiesResponse>