This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import NProgress from 'nprogress'; | |
import Router from "next/router"; | |
import PropTypes from 'prop-types'; | |
/* eslint-disable react/prefer-stateless-function */ | |
class NextNProgress extends React.Component { | |
static defaultProps = { | |
color: '#29D', | |
startPosition: 0.3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const sts = new AWS.STS(); | |
sts.assumeRole({ | |
DurationSeconds: 3600, | |
ExternalId: '1234-1234-1234-1234-1234', | |
RoleArn: "Your Role ARN", | |
RoleSessionName: 'abc' | |
}, (err, data) => { | |
if (err) throw err; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const sts = new AWS.STS(); | |
(async () => { | |
try { | |
const data = await sts.assumeRole({ | |
DurationSeconds: 3600, | |
ExternalId: '1234-1234-1234-1234-1234', | |
RoleArn: "Your Role ARN", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
const sts = new AWS.STS(); | |
sts | |
.assumeRole({ | |
DurationSeconds: 3600, | |
ExternalId: '1234-1234-1234-1234-1234', | |
RoleArn: 'Your Role ARN', | |
RoleSessionName: 'abc', | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = new AWS.S3(accessparams); | |
const url = s3.getSignedUrl('getObject', { | |
Bucket: 'BUCKET-NAME', | |
Key: 'path/to/your/file', | |
Expires: 60 * 5 // time in seconds: e.g. 60 * 5 = 5 mins | |
}) | |
console.log(url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = new AWS.S3(accessparams); | |
s3.getSignedUrl('getObject', { | |
Bucket: 'BUCKET-NAME', | |
Key: 'path/to/your/file', | |
Expires: 60 * 5, // time in seconds: e.g. 60 * 5 = 5 mins | |
}, (err, url) => { | |
if (err) throw err; | |
console.log(url); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = new AWS.S3(accessparams); | |
s3.getObject( | |
{ Bucket: 'BUCKET-NAME', Key: 'path/to/your/file' }, | |
(err, file) => { | |
if (err) throw err; | |
console.log(file.Body); | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = new AWS.S3(accessparams); | |
s3.getObject({ Bucket: 'BUCKET-NAME', Key: 'path/to/your/file' }) | |
.promise() | |
.then(file => { | |
console.log(file.Body); | |
}) | |
.catch(err => { | |
console.log(err); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3 = new AWS.S3(accessparams); | |
(async () => { | |
try { | |
const file = await s3 | |
.getObject({ Bucket: 'BUCKET-NAME', Key: 'path/to/your/file' }) | |
.promise(); | |
console.log(file.Body); | |
} catch (err) { | |
console.log(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require('aws-sdk'); | |
// Try to use process.env.PRIVATE_KEY instead of exposing your key | |
const privateKey = `-----BEGIN RSA PRIVATE KEY----- | |
XXXXXXXX | |
XXXXXXXX | |
XXXXXXXX | |
XXXXXXXX | |
-----END RSA PRIVATE KEY-----` |
OlderNewer