Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShareServiceClient

Package version

A ShareServiceClient represents a URL to the Azure Storage File service allowing you to manipulate file shares.

export
class

ShareServiceClient

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

Methods

createShare

deleteShare

getProperties

getShareClient

listShares

  • Returns an async iterable iterator to list all the shares under the specified account.

    .byPage() returns an async iterable iterator to list the shares in pages.

    example
      let i = 1;
      for await (const share of serviceClient.listShares()) {
        console.log(`Share ${i++}: ${share.name}`);
      }
    example
      // Generator syntax .next()
      let i = 1;
      let iter = await serviceClient.listShares();
      let shareItem = await iter.next();
      while (!shareItem.done) {
        console.log(`Share ${i++}: ${shareItem.value.name}`);
        shareItem = await iter.next();
      }
    example
      // Example for .byPage()
      // passing optional maxPageSize in the page settings
      let i = 1;
      for await (const response of serviceClient.listShares().byPage({ maxPageSize: 20 })) {
        if (response.shareItems) {
          for (const share of response.shareItems) {
            console.log(`Share ${i++}: ${share.name}`);
          }
        }
      }
    example
      // Passing marker as an argument (similar to the previous example)
      let i = 1;
      let iterator = serviceClient.listShares().byPage({ maxPageSize: 2 });
      let response = (await iterator.next()).value;
      // Prints 2 share names
      if (response.shareItems) {
        for (const share of response.shareItems) {
          console.log(`Share ${i++}: ${share.name}`);
        }
      }
      // Gets next marker
      let marker = response.continuationToken;
      // Passing next marker as continuationToken
      iterator = serviceClient.listShares().byPage({ continuationToken: marker, maxPageSize: 10 });
      response = (await iterator.next()).value;
      // Prints 10 share names
      if (response.shareItems) {
        for (const share of response.shareItems) {
          console.log(`Share ${i++}: ${share.name}`);
        }
      }
    memberof

    ShareServiceClient

    Parameters

    Returns PagedAsyncIterableIterator<ShareItem, ServiceListSharesSegmentResponse>

    An asyncIterableIterator that supports paging.

setProperties

Static fromConnectionString

  • Creates an instance of ShareServiceClient from connection string.

    memberof

    ShareServiceClient

    Parameters

    • connectionString: string

      Account connection string or a SAS connection string of an Azure storage account. [ Note - Account connection string can only be used in NODE.JS runtime. ] Account connection string example - DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=accountKey;EndpointSuffix=core.windows.net SAS connection string example - BlobEndpoint=https://myaccount.blob.core.windows.net/;QueueEndpoint=https://myaccount.queue.core.windows.net/;FileEndpoint=https://myaccount.file.core.windows.net/;TableEndpoint=https://myaccount.table.core.windows.net/;SharedAccessSignature=sasString

    • Optional options: StoragePipelineOptions

    Returns ShareServiceClient

    A new ShareServiceClient from the given connection string.

Generated using TypeDoc