스토리지 액세스 자격 증명을 제공하는 방법은 여러 가지가 있습니다. 환경 변수를 사용하여 계정 이름과 키를 설정하고 있습니다. 여기
내가 bash는 사용하여 환경 변수를 설정하는 방법입니다
echo Exporting Azure Storage variables ...
export AZURE_STORAGE_ACCOUNT='YOUR_ACCOUNT_NAME'
export AZURE_STORAGE_ACCESS_KEY='YOUR_ACCESS_KEY'
echo Done exporting Azure Storage variables
을 그리고 여기 샘플 내가 ImageMagick과를 사용하여, 하늘빛의 모양으로 저장되어있는 기존의 이미지 썸네일을 생성하는 데 사용할 스크립트를 Node.js를 수 있습니다 :
var azure = require('azure');
var im = require('imagemagick');
var fs = require('fs');
var rt = require('runtimer');
//Blobservice init
var blobService = azure.createBlobService();
var convertPath = '/usr/bin/convert';
var identifyPath = '/usr/bin/identify';
global.once = false;
var blobs = blobService.listBlobs("screenshots", function (error, blobs) {
if (error) {
console.log(error);
}
if (!error) {
blobs.forEach(function (item) {
if (item.name) {
if (item.name.length == 59) {
//Create the name for the thum
var thumb = item.name.substring(0, item.name.indexOf('_')) + '_thumb.png';
if (!global.once) {
console.log(global.once);
var info = blobService.getBlobToFile("YOUR CONTAINER", item.name, item.name,
function (error, blockBlob, response) {
im.resize({
srcPath: item.name,
dstPath: thumb,
width: 100,
height: 200
},
function (err, sdout, stderr) {
if (err) throw err;
console.log("resized");
//Delete the downloaded BIG one
fs.unlinkSync(item.name);
//Upload the thumbnail
blobService.putBlockBlobFromFile("YOUR CONTAINER", thumb, thumb,
function (error, blockBlob, response) {
if (!error) {
console.log("blob uploaded: " + thumb);
fs.unlinkSync(thumb);
}
});
});
});
//DEBUG: Uncomment to test only with one file
//global.once = true;
}
}
}
});
}
});
그리고 여기가 노드의 푸른 모듈에 공식 링크입니다 (이것은 일부 샘플이 포함되어 있습니다) :
Windows Azure Client Library for node
대단원! 답장을 보내 주셔서 감사합니다. – balanv