A promise wrapper for Azure Storage. Github repo
You can read about Azure Storage.
If the outermost storage inside the resource, such as a share or container, doesn't exist, it is created as part of the request.
For Blob storage, the base directory is known as an empty string.
- Azure subscription
- Azure Storage resource and its connection string, found on the Keys page of the resource in the Azure portal.
Install via NPM
npm install azure-storage-as-promised
Usage in tests
The tests include usage of objects.
This method signature changed in V 0.9.0.
;const BlobStorage = Blob;const myblob = processenvAZURESTORAGECONNECTIONSTRING;const container="function-blob-upload";const directory=""; // root dir is empty stringconst blob="short.txt";const finalBlob = directory + '/' + blob;myblob
Usage with File in typescript
// import classes in package;// set connection stringconst fileAzure = processenvAZURESTORAGECONNECTIONSTRING;// create directory which creates shareconst directoryResult = await fileAzure;// check that share does existconst shareResult:any = await fileAzure;// check that directory does existconst doesDirectoryExist = await fileAzure;// add fileconst fileResult:any = await fileAzure;// get file propertiesconst fileProperties:any = await fileAzure;// get file downloadconst url:any = await fileAzure;// get base directories, empty string is base directoryconst directoriesAndFiles:any = await fileAzure;// get subdir filesconst subDirectoriesAndFiles:any = await fileAzure;// delete directory and all files withinconst deleteDirectoryResults:any = await fileAzure;// check that directory doesn't existconst doesDirectoryExist2:any = await fileAzure;// delete Shareconst deleteShareResult:any = await fileAzure;
npm run test
Blob.getBlobProperties has new signature - directory is now a part of blob. For example, if directory is 'abc' and blob name is 'xyz', these are passing in as the blob variable, 'xyz/abc'.