npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nexrender/provider-s3

v1.53.2

Published

Allows nexrender to interact with an Amazon Web Services S3 storage.

Downloads

3,106

Readme

Provider: S3

Allows nexrender to interact with an Amazon Web Services S3 storage.

Refer to aws/aws-sdk-js for information regarding general abilities and usage.

Installation

npm i @nexrender/provider-s3 -g

Authentication

Providing credentials can be done in the following ways

Credentials parameter

For both downloads and uploads you can provide a credentials object to the params with either an access key ID and a secret key, or an AWS profile name that's configured in ~/.aws/credentials

  • credentials.profile optional argument, a specific AWS credentials profile to use for authentication.
  • credentials.accessKeyId optional argument, a specific accessKeyId to use for authentication. Requires secretAccessKey to also be specified.
  • credentials.secretAccessKey optional argument, a specific secretAccessKey to use for authentication. Requires accessKeyId to also be specified.

Environment variables

You can provide either an access key ID and a secret key, or an AWS profile name that's configured in ~/.aws/credentials

You can do it in your current console session

; windows
set AWS_ACCESS_KEY="YOUR_ACCESS_KEY"
set AWS_SECRET_KEY="YOUR_SECRET_KEY"
; or

set AWS_PROFILE="YOUR_PROFILE_NAME"
# unix
export AWS_ACCESS_KEY="YOUR_ACCESS_KEY"
export AWS_SECRET_KEY="YOUR_SECRET_KEY"
# or
export AWS_PROFILE="YOUR_PROFILE_NAME"

Cross-account role access pattern

For elaborate security enviroments you could be using cross-account role access pattern to grant access to the assets and uploads.

All properties from the credentials object gets passed inside params passed to the ChainableTemporaryCredentrials constructor { params: { ...credentials } }

  • credentials.RoleArn required argument, Amazon Resource Name (ARN) of the role to assume.
  • credentials.RoleSessionName required argument, an identifier for the assumed role session.
  • credentials.ExternalId optional argument, a unique identifier that is common to be required when you assume a role in another account.
  • other parameters that are supported by the SDK ChainableTemporaryCredentrials class.

To change the master credentials, adjust global AWS configuration before starting the job i.e. by environment variables or assigning an EC2 instance role. For full list of parameters please refer to JS SDK docs

Usage (download)

To download assets from an S3 bucket you would need to specify relevant information for every asset:

Refer to AWS SDK Documentation for information on setting credentials.

{
    "assets": [
        {
            "src": "s3://mybucket.s3.us-east-1.amazonaws.com/background.jpg",
            "type": "image",
            "layerName": "background.png"
        },
        {
            "src": "s3://myotherbucket.s3.amazonaws.com/audio.mp3",
            "type": "audio",
            "layerName": "theme.mp3",
            "params": {
                "credentials": {
                    "accessKeyId": "YOUR_ACCESS_KEY",
                    "secretAccessKey": "YOUR_SECRET_KEY"
                }
            }
        }
    ]
}

Uri follows this scheme:

s3://[BUCKET].s3.[REGION].amazonaws.com/[KEY]

If region is not provided, the default region of us-east-1 will be used.

Usage (upload)

Upload via FTP can be done using @nexrender/action-upload

Basic params info:

  • region required argument, the S3 bucket region
  • bucket required argument, the S3 bucket
  • key required argument, the object key
  • acl required argument, the ACL
  • contentType optional argument [default: application/octet-stream] the object ContentType, see: API PutObject AWS S3
  • credentials optional argument, see: credentials parameter

Example:

{
    "actions": {
        "postrender": [
            {
                "module": "@nexrender/action-upload",
                "input": "result.mp4",
                "provider": "s3",
                "params": {
                    "region": "us-east-1",
                    "bucket": "name-of-your-bucket",
                    "key": "folder/output.mp4",
                    "acl": "public-read",
                    "contentType": "video/mp4",
                    "credentials": {
                        "profile": "YOUR_PROFILE_NAME"
                    }
                }
            }
        ]
    }
}