in src/extension.ts [106:133]
function uploadFile(api: AzureAccountExtensionApi, uri?: Uri) {
(async () => {
let shell = shells[0];
if (!shell) {
const shellName = await window.showInformationMessage(localize('azure-account.uploadingRequiresOpenCloudConsole', "File upload requires an open Cloud Shell."), OSes.Linux.shellName, OSes.Windows.shellName);
if (!shellName) {
return;
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
shell = cloudConsole(api, shellName === OSes.Linux.shellName ? 'Linux' : 'Windows')!;
}
if (!uri) {
uri = (await window.showOpenDialog({}) || [])[0];
}
if (uri) {
const filename = basename(uri.fsPath);
return window.withProgress({
location: ProgressLocation.Notification,
title: localize('azure-account.uploading', "Uploading '{0}'...", filename),
cancellable: true
}, (progress, token) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return shell.uploadFile(filename, createReadStream(uri!.fsPath), { progress, token });
});
}
})()
.catch(logErrorMessage);
}