Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

azurite

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azurite - npm Package Compare versions

Comparing version 0.4.3 to 0.4.4

lib/api/PutBlockList.js

3

lib/api/CreateBlockBlob.js

@@ -44,3 +44,4 @@ 'use strict';

httpHeader['x-ms-blob-content-md5'] || httpHeader['Content-MD5'],
httpHeader['x-ms-blob-cache-control'] || httpHeader['Cache-Control']);
httpHeader['x-ms-blob-cache-control'] || httpHeader['Cache-Control'],
true)
}

@@ -47,0 +48,0 @@

@@ -21,2 +21,5 @@ 'use strict';

.catch((e) => {
if (e.code === 'ContainerNotFound') {
res.status(404).send('ContainerNotFound');
}
res.status(500).send();

@@ -23,0 +26,0 @@ throw e;

@@ -7,3 +7,4 @@ 'use strict';

getBlobHandler = require('./../api/GetBlob'),
putBlockHandler = require('./../api/PutBlock');
putBlockHandler = require('./../api/PutBlock'),
putBlockListHandler = require('./../api/PutBlockList');

@@ -28,2 +29,4 @@ /*

// PUT Blob
} else if (req.query.comp === 'blocklist') {
putBlockListHandler.process(req, res, req.params.container, req.params.blob, req.body);
} else if (blobType === 'BlockBlob') {

@@ -30,0 +33,0 @@ createBlockBlobHandler.process(req, res, req.params.container, req.params.blob);

@@ -9,2 +9,3 @@ 'use strict';

md5 = require('md5'),
CombinedStream = require('combined-stream'),
BlobHttpProperties = require('./model/BlobHttpProperties');

@@ -166,2 +167,7 @@

const coll = this.db.getCollection(containerName);
if (!coll) {
const e = new Error();
e.code = 'ContainerNotFound';
throw e;
}
let blobs = coll.chain()

@@ -203,4 +209,4 @@ .find({ 'name': { '$contains': options.prefix } })

});
}
}
// Checking MD5 in case 'Content-MD5' header was set.

@@ -233,2 +239,3 @@ const sourceMD5 = options.httpProps['Content-MD5'];

name: options.fileName,
blockId: options.blockId,
parent: options.parent,

@@ -249,4 +256,52 @@ http_props: options.httpProps

}
putBlockList(containerName, blobName, blockList, httpProps, metaProps) {
const response = {};
return BbPromise.try(() => {
const combinedStream = CombinedStream.create();
for (const block of blockList) {
const blockName = `${containerName}-${blobName}-${block.id}`;
const blockPath = path.join(env.commitsPath, blockName);
combinedStream.append(fs.createReadStream(blockPath));
}
const blobPath = path.join(env.localStoragePath, containerName, blobName);
combinedStream.pipe(fs.createWriteStream(blobPath));
const coll = this.db.getCollection(containerName);
const blobResult = coll.chain()
.find({ 'name': { '$eq': blobName } })
.data();
// Blob must exist in DB since preceding calls to "PUT Block"
const updateBlob = blobResult[0];
updateBlob.http_props = httpProps;
updateBlob.meta_props = metaProps;
coll.update(updateBlob);
response.ETag = updateBlob.meta.revision;
response.lastModified = httpProps.lastModified;
})
.then(() => {
// Set Blocks in DB to committed = true, delete blocks not in BlockList
const promises = [];
const coll = this.db.getCollection(COMMITS);
const blocks = coll.chain()
.find( { parent: `${containerName}-${blobName}` })
.data();
for (const block of blocks) {
if (blockList.map((e) =>{ return e.id}).indexOf(block.blockId) !== -1) {
block.http_props.committed = true;
coll.update(block);
} else {
coll.remove(block);
promises.push(fs.removeAsync(path.join(env.commitsPath, block.name)));
}
}
return BbPromise.all(promises)
})
.then(() => {
return response;
})
}
}
module.exports = new StorageManager;
{
"name": "azurite",
"version": "0.4.3",
"version": "0.4.4",
"description": "A lightweight server clone of Azure Blob Storage that simulates most of the commands supported by it with minimal dependencies.",

@@ -38,2 +38,3 @@ "scripts": {

"chalk": "^1.1.3",
"combined-stream": "^1.0.5",
"express": "^4.14.0",

@@ -45,4 +46,5 @@ "fs-extra": "^1.0.0",

"minimist": "^1.2.0",
"request": "^2.79.0"
"request": "^2.79.0",
"xml2js": "^0.4.17"
}
}

@@ -109,3 +109,3 @@ # Azurite

## Put Block List
## Put Block List [DONE]
Block blobs only

@@ -112,0 +112,0 @@ Commits a blob by specifying the set of block IDs that comprise the block blob.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc