我在amazon aws docs上找到了this example。
var glacier = new AWS.Glacier(),
vaultName = 'YOUR_VAULT_NAME',
buffer = new Buffer(2.5 * 1024 * 1024); // 2.5MB buffer
var params = {vaultName: vaultName, body: buffer};
glacier.uploadArchive(params, function(err, data) {
if (err) console.log("Error uploading archive!", err);
else console.log("Archive ID", data.archiveId);
});
但我不明白我的文件在哪里,或者如何将其发送到冰川服务器?
答案 0 :(得分:4)
该文件存储在vaultName
中,您在那里提供的价值。 data.archiveId
是文件的表示。 body
是自己的文件。
Here is a more general overview of Glacier
Q: How is data within Amazon Glacier organized?
Cody示例:(由hitautodestruct提供)
var AWS = require('aws-sdk'),
fs = require('fs'),
glacier = new AWS.Glacier(),
vaultName = 'YOUR_VAULT_NAME',
// No more than 4GB otherwise use multipart upload
file = fs.readFileSync('FILE-TO-UPLOAD.EXT');
var params = {vaultName: vaultName, body: file};
glacier.uploadArchive(params, function(err, data) {
if (err) console.log("Error uploading archive!", err);
else console.log("Archive ID", data.archiveId);
});