I
I
Ilya Magdenko2019-04-10 16:13:40
JavaScript
Ilya Magdenko, 2019-04-10 16:13:40

How to download automatically all folders with nodejs in azure?

You need to test one function, for this you need this functionality. Thanks for the help.
There is a piece of code that shows all folders in the C: ILJATEST directory

var dirPath = path.join("C:\\", 'ILJATEST');
    fs.readdir(dirPath, function (err, files) {
        if (err) {
            return console.log('Unable to scan dir ' + err);
        }
        files.forEach(function (file) {

            console.log(file);
        });
    });

There is also a working code that, after selecting a file and clicking on the button, uploads the file to the server. Here's the part that does it:
document.getElementById('upload-button').addEventListener('click', () => {
            const file = document.getElementById('fileinput').files[0];
            blobService.createBlockBlobFromBrowserFile('mycontainer',
                file.name,
                file,
                (error, result) => {
                    if (error) {
                        // Handle blob error
                    } else {
                        console.log('Upload is successful');
                    }
                });
        });

How to combine them so that when the application is launched, all folders from this directory are automatically uploaded to the server?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question