Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including pdf2-s3 with all npm packages installed. Try it out:

var pdf2S3 = require("pdf2-s3")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

pdf2-s3 v2.0.4

Download a pdf from a web url and uploads to a given s3 bucket

Description

This library will download a pdf from a given web url and upload it to a given s3 bucket.

How to install

npm install pdf2-s3

Prerequisite

You should have AWS configuration settings setup before using Pdf2S3. If you haven't done that already, Create a credentials file at ~/.aws/credentials on Mac/Linux or C:\Users\USERNAME.aws\credentials on Windows. Add your credentials to that .aws file as follows.

[default]
aws_access_key_id = your_access_key
aws_secret_access_key = your_secret_key

More Information : http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html

How to Use

var Pdf2S3 = require('pdf2-s3'),
    options = {
        url: 'https://test.com/test.pdf', 
        bucketName: 'my-pdf-uploads', 
        key: 'subfolder-name/pdf-name.pdf' // optional
    }
   
Pdf2S3.start(options, function(err, path) {
        // path variable contains the s3 bucket file url of the uploaded pdf. 
        if (err) {
            console.log(err);
            /* Your error handling code */
        } else {
            console.log(path);
            /* Your code here */
        }
    });

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free