Skip to main content

Using Pre-Marked URL NODEJS With Stook

You can create pre-signed URLs for any Stook operation and using the getSignedUrl() method you can call these URLs.

Sample Code

CODE
1.  var AWS = require('aws-sdk');  
2.  var config = {  
3.      s3ForcePathStyle: true,  
4.  }  
5.  var credentials = new AWS.SharedIniFileCredentials({  
6.      profile: 'medianova'  
7.  });  
8.  AWS.config.credentials = credentials;  
9.  AWS.config.update(config);  
10.  var ep = new AWS.Endpoint('customername.mncdn.com');  
11.  var s3 = new AWS.S3({endpoint: ep});  
12.  
13.  var myBucket = 'bucket';  
14.  var myKey = 'mykey’;  
15.  var signedUrlExpireSeconds = 60 * 5;  
16.  
17.  var url = s3.getSignedUrl('getObject', {  
18.      Bucket: myBucket,  
19.      Key: myKey,  
20.      Expires: signedUrlExpireSeconds  
21.  }) console.log(url)  

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.