Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify storage-file-share/README.md #10432

Merged
merged 3 commits into from
Aug 11, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 20 additions & 15 deletions sdk/storage/storage-file-share/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ To use this client library in the browser, first you need to use a bundler. For

Currently only `Parcel` and `Rollup` work well with Storage client libraries for IE11.

If `Parcel` is used then no further work is needed. If using Rollup, an additional step is needed to transform the bundled output to the format that IE11 supports.
If `Parcel` is used then no further work is needed. If using Rollup, an additional step is needed to transform the bundled output to the format that IE11 supports.

Assuming `bundled-output.js` is the result from `Rollup`:

Expand Down Expand Up @@ -126,6 +126,15 @@ The following components and their corresponding client libraries make up the Az

## Examples

- [Import the package](#import-the-package "Import the package")
- [Create the share service client](#create-the-share-service-client "Create the share service client")
- [List shares in the account](#list-shares-in-the-account "List shares in the account")
- [Create a new share and a directory](#create-a-new-share-and-a-directory "Create a new share and a directory")
- [Create an azure file then upload to it](#create-an-azure-file-then-upload-to-it "Create an azure file then upload to it")
- [List files and directories under a directory](#list-files-and-directories-under-a-directory "List files and directories under a directory")
- [Download a file and convert it to a string (Node.js)](#download-a-file-and-convert-it-to-a-string-nodejs "Download a file and convert it to a string (Node.js)")
- [Download a file and convert it to a string (Browsers)](#download-a-file-and-convert-it-to-a-string-browsers "Download a file and convert it to a string (Browsers)")
JosueJoshua marked this conversation as resolved.
Show resolved Hide resolved

### Import the package

To use the clients, import the package into your file:
Expand Down Expand Up @@ -176,7 +185,7 @@ const account = "<account name>";
const sas = "<service Shared Access Signature Token>";

const serviceClientWithSAS = new ShareServiceClient(
`https://${account}.file.core.windows.net${sas}`,
`https://${account}.file.core.windows.net${sas}`
);
```

Expand Down Expand Up @@ -433,24 +442,20 @@ const { ShareServiceClient } = require("@azure/storage-file-share");
const account = "<account name>";
const sas = "<service Shared Access Signature Token>";
const shareName = "<share name>";
const fileName = "<file name>"
const fileName = "<file name>";

const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net${sas}`
);
const serviceClient = new ShareServiceClient(`https://${account}.file.core.windows.net${sas}`);

async function main() {
const fileClient = serviceClient.getShareClient(shareName)
.rootDirectoryClient
.getFileClient(fileName);
const fileClient = serviceClient
.getShareClient(shareName)
.rootDirectoryClient.getFileClient(fileName);
JosueJoshua marked this conversation as resolved.
Show resolved Hide resolved

// Get file content from position 0 to the end
// In browsers, get downloaded data by accessing downloadFileResponse.blobBody
// Get file content from position 0 to the end
// In browsers, get downloaded data by accessing downloadFileResponse.blobBody
const downloadFileResponse = await fileClient.download(0);
console.log(
`Downloaded file content: ${await blobToString(
await downloadFileResponse.blobBody
)}`
`Downloaded file content: ${await blobToString(await downloadFileResponse.blobBody)}`
);
}

Expand All @@ -466,7 +471,7 @@ async function blobToString(blob) {
});
}

main()
main();
```

A complete example of basic scenarios is at [samples/typescript/src/basic.ts](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/storage/storage-file-share/samples/typescript/src/basic.ts).
Expand Down