如何使用NodeJS将文件从AWS Glacier存储直接下载到本地PC?

时间:2019-02-08 09:17:52

标签: javascript node.js amazon-web-services amazon-glacier aws-sdk-nodejs

我正在使用AWS Glacier存储通过aws-sdk为Node js存储旧文件。我可以将文件从本地PC上传到存储设备,但是无法将其从存储设备下载到本地。

是否可以编写代码将文件直接下载到本地而不是S3?

var params = {
    accountId: "example", 
    jobParameters: {
        Description: "My inventory job", 
        Type: "inventory-retrieval"
    }, 
    vaultName: "example",
};



glacier.initiateJob(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else {

        console.log("job initated job successfully", data);    

        var params = {
            accountId: "example", 
            jobId: 'example', 
            vaultName: "example"
        };
        glacier.describeJob(params, function(err, data) {
            if (err) console.log(err, err.stack); // an error occurred
            else  {
                console.log('Job description ', data);      


                var params = {
                accountId: "example", 
                jobId: 'example',  
                vaultName: "example"
                };
                glacier.getJobOutput(params, function(err, data) {
                if (err) console.log(err, err.stack); // an error occurred
                else     console.log(data);           // successful response

                });


            }

        })
    }


});

0 个答案:

没有答案