1
0
Fork 0
js-stream-issue/index.js

17 lines
455 B
JavaScript
Raw Normal View History

2017-02-01 10:20:59 -05:00
const BUCKET = "atomakabucket"
const unzipper = require("unzipper")
const aws = require("aws-sdk")
aws.config.update({ region: "us-east-1" })
const s3 = new aws.S3()
s3
.getObject({ Bucket: BUCKET, Key: "hello.zip" })
.createReadStream()
.pipe(unzipper.Parse())
.on('entry', file => {
s3.putObject({ Bucket: BUCKET, Key: file.path, Body: file }).promise()
2017-02-01 10:45:11 -05:00
.then(() => console.log("success"))
2017-02-01 10:20:59 -05:00
.catch(err => console.log(err))
})