Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws3.js

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws3.js - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

26

aws3.js

@@ -13,3 +13,3 @@ /* jshint laxcomma: true */

Aws3.s3Bucket = process.env.S3_BUCKET || 'aws3_bucket';
Aws3.region = process.env.AWS_REGION || 's3';
Aws3.awsRegion = process.env.AWS_REGION || 'us-east-1';

@@ -33,2 +33,3 @@

this.asattachment = false; // must be explicitly set eg. aws3.asattachment = true;
this.awsregion = Aws3.awsRegion;
}

@@ -107,4 +108,25 @@

Aws3.prototype.regionExtension = function() {
if (this.awsregion !== 'us-east-1') {
return '-'+this.awsregion;
}
return '';
};
/*
* @api private
*/
Aws3.prototype.subdomain = function() {
return 's3'+this.regionExtension();
};
/*
* @api private
*/
Aws3.prototype.s3Url = function() {
return 'https://'+Aws3.region+'.amazonaws.com/'+Aws3.s3Bucket;
return 'https://'+this.subdomain()+'.amazonaws.com/'+Aws3.s3Bucket;
};

@@ -111,0 +133,0 @@

2

package.json
{
"name": "aws3.js",
"version": "0.0.7",
"version": "0.0.8",
"description": "Simple AWS S3 Generator",

@@ -5,0 +5,0 @@ "main": "aws3.js",

@@ -143,2 +143,32 @@ /* jshint laxcomma: true */

});
describe('alternate regions', function() {
it('defaults to the us-east-1 region', function() {
var aws3 = new Aws3('large.txt', 'text/plain');
assert.equal(aws3.subdomain(), 's3');
var aws32 = new Aws3('large.txt', 'text/plain');
aws32.awsregion = 'us-east-1';
assert.equal(aws32.subdomain(), 's3');
});
it('can have the region set globally', function() {
Aws3.awsRegion = 'us-west-2';
var aws3 = new Aws3('large.txt', 'text/plain');
assert.equal(aws3.subdomain(), 's3-us-west-2');
var aws32 = new Aws3('large.txt', 'text/plain');
assert.equal(aws32.subdomain(), 's3-us-west-2');
});
it('can have the region set for each instance', function() {
var aws3 = new Aws3('large.txt', 'text/plain');
aws3.awsregion = 'us-west-2';
assert.equal(aws3.subdomain(), 's3-us-west-2');
var aws32 = new Aws3('large.txt', 'text/plain');
aws32.awsregion = 'us-west-3';
assert.equal(aws32.subdomain(), 's3-us-west-3');
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc