in src/AzureStorageFS.ts [208:238]
async readFile(uri: vscode.Uri): Promise<Uint8Array> {
let client: ShareFileClient | BlobClient;
let downloaded: FileDownloadResponseModel | BlobDownloadResponseModel;
return await callWithTelemetryAndErrorHandling('readFile', async (context) => {
context.telemetry.suppressIfSuccessful = true;
context.errorHandling.rethrow = true;
context.errorHandling.suppressDisplay = true;
let result: string | undefined;
const parsedUri = this.parseUri(uri);
const treeItem: FileShareTreeItem | BlobContainerTreeItem = await this.lookupRoot(uri, context, parsedUri.resourceId);
try {
if (treeItem instanceof FileShareTreeItem) {
client = createFileClient(treeItem.root, treeItem.shareName, parsedUri.parentDirPath, parsedUri.baseName);
} else {
client = createBlobClient(treeItem.root, treeItem.container.name, parsedUri.filePath);
}
downloaded = await client.download();
result = await this.streamToString(downloaded.readableStreamBody);
} catch (error) {
const pe = parseError(error);
if (pe.errorType === 'BlobNotFound' || pe.errorType === 'ResourceNotFound') {
throw getFileSystemError(uri, context, vscode.FileSystemError.FileNotFound);
}
throw error;
}
return Buffer.from(result || '');
}) || Buffer.from('');
}