export async function azFilePush()

in src/shared.ts [76:117]


export async function azFilePush(
    workspaceName: string,
    storageAccountName: string,
    storageAccountKey: string,
    fileShareName: string,
    fileName: string): Promise<void> {

    const fs = azureStorage.createFileService(storageAccountName, storageAccountKey);
    const cf = new CloudFile(
        workspaceName,
        fileShareName,
        fileName,
        FileSystem.local);
    const pathCount = cf.cloudShellDir.split(path.sep).length;

    // try create file share if it does not exist
    try {
        await createShare(cf, fs);
    } catch (error) {
        console.log(`Error creating FileShare: ${cf.fileShareName}\n\n${error}`);
        return;
    }

    // try create directory path if it does not exist, dirs need to be created at each level
    try {
        for (let i = 0; i < pathCount; i++) {
            await createDirectoryPath(cf, i, fs);
        }
    } catch (error) {
        console.log(`Error creating directory: ${cf.cloudShellDir}\n\n${error}`);
        return;
    }

    // try create file if not exist
    try {
        await createFile(cf, fs);
    } catch (error) {
        console.log(`Error creating file: ${cf.localUri}\n\n${error}`);
    }

    return;
}