Reader small image

You're reading from  Socket.IO Cookbook

Product typeBook
Published inOct 2015
Reading LevelIntermediate
PublisherPackt
ISBN-139781785880865
Edition1st Edition
Languages
Right arrow
Author (1)
Tyson Cadenhead
Tyson Cadenhead
author image
Tyson Cadenhead

Tyson Cadenhead works as a senior JavaScript engineer at Aloompa in Nashville, Tennessee. He has dedicated his professional career to building large-scale applications in JavaScript and Node. Tyson addresses audiences at various conferences and programming meetups on how to build real-time web applications with Socket.IO or Meteor.js. He blogs on topics such as JavaScript and web technologies at http://www.tysoncadenhead.com. Tyson lives in the greater Nashville area with his wife and two sons, where he enjoys gardening, raising chickens, reading philosophy and economics books, and playing guitar.
Read more about Tyson Cadenhead

Right arrow

Uploading an image to Amazon S3


Uploading images to your server-side filesystem is actually not a great idea. If you are deploying from your repo, you don't want to mix in user-generated media with your code. A much better and more scalable approach is to put your photos and other media in a completely separate static location, such as Amazon S3, where you can access them without letting them interfere with your core application.

In this recipe, we will upload images to Amazon S3 and display them after they are uploaded.

Getting ready…

For this recipe, we will use the Amazon SDK for Node. It can be installed by running npm install aws-sdk –save in your terminal. We will also use lodash (npm install lodash --save) and the q promise library (npm install q --save).

How to do it…

To upload an image to Amazon S3, follow these steps:

  1. First, we will create an aws.service.js file. This file will be responsible for interfacing with the Amazon AWS SDK and writing and reading binary data from Amazon. We...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Socket.IO Cookbook
Published in: Oct 2015Publisher: PacktISBN-13: 9781785880865

Author (1)

author image
Tyson Cadenhead

Tyson Cadenhead works as a senior JavaScript engineer at Aloompa in Nashville, Tennessee. He has dedicated his professional career to building large-scale applications in JavaScript and Node. Tyson addresses audiences at various conferences and programming meetups on how to build real-time web applications with Socket.IO or Meteor.js. He blogs on topics such as JavaScript and web technologies at http://www.tysoncadenhead.com. Tyson lives in the greater Nashville area with his wife and two sons, where he enjoys gardening, raising chickens, reading philosophy and economics books, and playing guitar.
Read more about Tyson Cadenhead