Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function main() {
// Enter your storage account name and shared key
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";
// Use StorageSharedKeyCredential with storage account and account key
// StorageSharedKeyCredential is only avaiable in Node.js runtime, not in browsers
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
// Use sharedKeyCredential or anonymousCredential to create a pipeline
const pipeline = newPipeline(sharedKeyCredential, {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
retryOptions: { maxTries: 4 }, // Retry options
userAgentOptions: { userAgentPrefix: "AdvancedSample V1.0.0" } // Customized telemetry string
});
// List shares
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
pipeline
);
console.log(`List shares`);
let i = 1;
for await (const share of serviceClient.listShares()) {
console.log(`Share ${i++}: ${share.name}`);
}
export async function main() {
// Enter your storage account name and shared key
const account = process.env.ACCOUNT_NAME || "";
const accountKey = process.env.ACCOUNT_KEY || "";
// Use StorageSharedKeyCredential with storage account and account key
// StorageSharedKeyCredential is only avaiable in Node.js runtime, not in browsers
const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey);
// Use sharedKeyCredential or anonymousCredential to create a pipeline
const pipeline = newPipeline(sharedKeyCredential, {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
retryOptions: { maxTries: 4 }, // Retry options
userAgentOptions: { userAgentPrefix: "AdvancedSample V1.0.0" } // Customized telemetry string
});
// List shares
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net`,
pipeline
);
console.log(`List shares`);
let i = 1;
for await (const share of serviceClient.listShares()) {
console.log(`Share ${i++}: ${share.name}`);
}
async function main() {
// Fill in following settings before running this sample
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";
const localFilePath = "README.md";
const pipeline = newPipeline(new AnonymousCredential(), {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
retryOptions: { maxTries: 4 }, // Retry options
userAgentOptions: { userAgentPrefix: "AdvancedSample V1.0.0" }, // Customized telemetry string
keepAliveOptions: {
// Keep alive is enabled by default, disable keep alive by setting false
enable: false
}
});
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net${accountSas}`,
pipeline
);
// Create a share
const shareName = `newshare${new Date().getTime()}`;
export async function main() {
// Fill in following settings before running this sample
const account = process.env.ACCOUNT_NAME || "";
const accountSas = process.env.ACCOUNT_SAS || "";
const localFilePath = "README.md";
const pipeline = newPipeline(new AnonymousCredential(), {
// httpClient: MyHTTPClient, // A customized HTTP client implementing IHttpClient interface
retryOptions: { maxTries: 4 }, // Retry options
userAgentOptions: { userAgentPrefix: "AdvancedSample V1.0.0" }, // Customized telemetry string
keepAliveOptions: {
// Keep alive is enabled by default, disable keep alive by setting false
enable: false
}
});
const serviceClient = new ShareServiceClient(
`https://${account}.file.core.windows.net${accountSas}`,
pipeline
);
// Create a share
const shareName = `newshare${new Date().getTime()}`;