Tag: azure storage

在Node js的Azure表存储中插入实体时,请添加PartitionKey

当调用insertEntity()时,这更多的是调用exception的帮助。 我在Azure上使用Nodejs并在摩纳哥进行编辑,而且我使用NPM安装了最新版本的Azure存储。 我遇到的exception是:(完整的堆栈跟踪底部) Unaughtexception:错误:函数entityOperation的参数entityDescriptor.PartitionKey应该是ArgumentValidator ._中的对象。extend.object 我基本上把我的对象保存,并创build2个新的属性: PartitionKey和RowKey 。 我给他们的string值。 我正在跟着例子 。 我没有使用entityGenerator,因为这里的示例没有这样做,而Azure Node开发人员门户上的示例却这样做。 如果需要,我不介意在存储特定的属性上使用entityGenerator,但是在azure github回购节点中的样本似乎表明您可以使用简单的string。 entityGenerator实际上看起来有点丑陋和麻烦,因为当你把它带回来的时候,你必须在实体上编写额外的代码。 如何调整我的代码来解决这个问题,并调用insertEntity()成功? exports.saveTally = function(tally, callback) { var tableSvc = getAzureTableService(); tableSvc.createTableIfNotExists("tally", function(error, result, response) { if (!error) { tally.PartitionKey="tally"; tally.RowKey = tally.id; tableSvc.insertEntity("tally", tally, function(error, result, response) { if (error) { console.log("*Error saving tally " + error.toString()); } else […]

更新后无法删除azure色的存储队列消息(消息未find)

使用node.js, azure-storage和fast-azure-storage两个不同的库,得到相同的结果。 这就是我所做的: 使用默认设置创build消息 – 确定。 从队列中获取消息 – 好的。 更新消息重置visibility timeout – 确定。 处理后删除消息 – 错误:MessageNotFound。 如果我跳过更新,一切顺利。 那么我做错了什么? PS试图分析httpstream量,似乎完全符合文档 。 像这是一个Azure的内部问题? 也许有人有使用其他语言库更新消息的经验吗? 由于auth头文件的计算太麻烦了。

Node.js azure-storage TableService没有方法

我一直在尝试连接到我的Azure存储帐户,但是我在使用azure存储模块时遇到了一些问题。 具体来说,一旦我创build一个TableService对象,对象只有一个过滤方法。 我试过的两个方法是queryTables和createTableIfNotExist。 例如,createTableIfNotExist返回“TypeError:aztd.createTableIfNotExistis不是函数”。 源代码如下。 var azure = require('azure-storage'); var aztd = azure.createTableService(); var azseg = azure.TableUtilities.entityGenerator; console.log("AZSEG " + Object.getOwnPropertyNames(azseg).filter(function (p) { return typeof azseg[p] === 'function'; })); console.log("AZTD " + Object.getOwnPropertyNames(aztd).filter(function (p) { return typeof aztd[p] === 'function'; })); aztd.createTableIfNotExist('table1', function (e, result, res) { if (result) console.log('Table created'); }); 除了没有find的function,我没有得到任何额外的错误。 控制台日志返回两个variables的函数: AZSEG […]

Nodejs使用.createBlockBlobFromLocalFile()将base64映像上传到azure blob存储

我想通过Base64表单上传从networking应用和移动应用发送的用户的个人资料图片。 在POST请求上,他们需要在正文上发送一个JSON 。 { "name":"profile-pic-123.jpg", "file":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxQTEhIUEhIUFBUV…K9rk8hCAEkjFMUYiEAI+nHIpsQh0AkisDYRTOiCAbWVtgCtI6IlkHh7LDTQXLH0EIQBj//2Q==" // the base64 image } 现在在服务器端使用Node和Express ,我使用了这个名为azure-storage npm模块,它提供了一个使用web服务将file upload到azure blob存储的好方法。 但是有一些我无法理解的。 这里是我的控制器的一部分代码。 我成功创build了所有必要的连接和键,以及创build一个blobService : controllers.upload = function(req, res, next){ // … // generated some sastoken up here // etc. // … var uploadOptions = { container: 'mycontainer', blob: req.body.name, // im not sure about this path: req.body.file // im […]

添加caching控制和Expires头到Azure Blob存储节点JS

我正在使用Azure存储来提供静态文件blob,但是我想在提供服务时将caching控制和Expires头添加到文件/ Blob,以降低带宽成本。 但是我正在使用节点JS 我如何做到这一点? 这是我到现在为止: 更简单的解决scheme: jsfiddle.net/fbqsfap2 //https://myaccount.blob.core.windows.net/mycontainer/myblob?comp=properties function updateBlob(blobName, containerName, accountName, properties) { let xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == XMLHttpRequest.DONE ) { console.log(xmlhttp.status); if (xmlhttp.status == 200) { const updatedPropertiesStr = getPropertiesKeysStr(properties); console.log("Update sucessfully ", updatedPropertiesStr); } else if (xmlhttp.status == 400) { console.log('There was an error 400'); […]

如何使用nodejs或其他方式列出所有的azure色容器?

有没有办法从Azure存储帐户列出所有容器? 如果是nodejs意味着对我很有帮助,否则请build议我列出所有容器的方法。

部署到云时,无法将实体添加到node.js中的azure色存储表中?

我在node.js中使用socket.io在我的Azure云项目中实现聊天function。 在这里,我一直使用node.js将用户聊天logging添加到表格中。 它工作正常,当我在我的本地模拟器上运行它,但奇怪的是,当我部署到我的azure色的云,它不工作,它不吐出任何错误,所以它真的让人难以置信。 以下是我的代码。 var app = require('express')() , server = require('http').createServer(app) , sio = require('socket.io') , redis = require('redis'); var client = redis.createClient(); var io = sio.listen(server,{origins: '*:*'}); io.set("store", new sio.RedisStore); process.env.AZURE_STORAGE_ACCOUNT = "account"; process.env.AZURE_STORAGE_ACCESS_KEY = "key"; var azure = require('azure'); var chatTableService = azure.createTableService(); createTable("ChatUser"); server.listen(4002); socket.on('privateChat', function (data) { var receiver = […]

Azure Blob存储哈希不匹配(完整性检查失败)

我正在关注http://willi.am/blog/2014/07/03/azure-blob-storage-and-node-downloading-blobs/ 。 但是,尽pipe代码完全相同,但是当我下载Blob时,Azure会给出错误: [错误:哈希不匹配(完整性检查失败),期望值是…] 正在运行的行是blobService.getBlobToText,其中blobService是与Azure的连接(createBlobService …) 这是怎么回事? :S 我的代码如下: // Azure test function downloadImageAsText(blobService, containerName, blobName) { blobService.getBlobToText( containerName, blobName, function(err, blobContent, blob) { if (err) { console.error("Couldn't download blob %s", blobName); console.error(err); } else { console.log("Sucessfully downloaded blob %s", blobName); console.log(blobContent); } }); } function uploadImage(blobService, containerName, blobName, fileName) { blobService.getBlobProperties( containerName, blobName, function(err, […]

Azure存储将图像从blob复制到blob

我正在使用Azure Storage Nodejs ,我需要做的是将图像从一个blob复制到另一个。 首先,我试图getBlobToFile获取磁盘中的临时位置的图像,然后从该临时位置createBlockBlobFromFile 。 这个方法完成了任务,但由于某种原因,它没有完全复制10%的情况。 我试图使用getBlobToText和结果放入createBlockBlobFromText ,也试图把需要blob的选项是图像容器。 该方法完全失败,复制后图像甚至不打开。 也许有一种方法来复制blob文件并将其粘贴到其他blobl,但我没有find该方法。 我还可以做些什么?

使用Node.js访问Azure表存储

我一直在使用node.js在Visual Studio中编写一个打字稿应用程序来存储和访问Azure表格存储中的数据。 我一直遇到一些麻烦,我find的教程。 我还没有得到一个正常工作。 我在我的机器上安装了节点,并在azure色的地方安装了一个桌面存储。 我不确定在Visual Studio中需要做什么来获得所有必要的包/模块/任何正确安装的东西。 我读过的许多教程都使用了express.js,或者有“npm install”编辑的东西,虽然我没有任何问题运行这些命令,但我并不真正了解我要安装的是什么。 tl; dr我想创build一个html页面,我可以使用node.js,typescript和visual studio将项目提交到azure表格存储和从Azure表格存储显示 另外:如果需要的话,我愿意放弃打字稿,转而使用javascript。