Upload Multiple Files in Node.js (Video Tutorial) (2024)

On this page:

  • Overview
  • Video tutorial
  • Tutorial contents
  • Keep learning

Overview

Learn how to upload assets in Node.js using the Cloudinary Node.js SDK.

Video tutorial

Tutorial contents

This tutorial presents the following topics. Click a timestamp to jump to that part of the video.

Upload one image using the Node.js SDK

0:12Once you have installed and configured the Cloudinary Node.js SDK, you can upload an image using the upload method of the Upload API. For example, to upload an image located at /images/image-1 in your file system:

Run the code and get a response

0:21Run the code using npm run. The result will contain a secure URL. Copy and paste the URL into your browser to view the uploaded image.

Upload multiple images

0:36To upload multiple images, you could create an array containing the file paths of the images you want to upload. Then, iterate through the array and apply the upload method to each image.

Run the code and get a response

0:58Run this code using npm run. You'll receive a response for each image, including its secure URL.

Install p-limit

1:11If you're uploading a large number of images, consider using a different upload method like p-limit. This enables you to concurrently utilize promises while controlling the maximum number of simultaneous executions. Install p-limit using npm install p-limit.

Set the concurrent promise limit

1:40Start by importing p-limit and specify the maximum number of promises that can execute concurrently. In this example, the limit is set to 10 concurrent promises, which fits the limitation for the free plan. For example, if you're uploading 100 images, 10 uploads will process concurrently until all images are uploaded.

Batch upload using p-limit

1:58Create a function called imagesToUpload, which maps over each image in the images array. Within this function, utilize p-limit to enforce the concurrent promise limit set earlier. Inside the limited function, use the upload method to upload each image. Specify the current image using image from the mapping and return the upload result. Execute the function using let uploads = await Promise.all(imagesToUpload); and log the results to the console.

Run the batch upload

2:44Run the code to initiate the uploads, and get an array containing the outcomes of all the promises.

Keep learning

Related topics

If you like this, you might also like...

Configure the Node.js SDK

Install and configure the Cloudinary Node.js SDK

Upload Videos in Node.js

Upload videos to Cloudinary using the Node.js SDK

Upload Widget

Embed an Upload Widget in your site

Upload Multiple Files in Node.js (Video Tutorial) (9)

Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.

Upload Multiple Files in Node.js (Video Tutorial) (2024)
Top Articles
How to activate Windows offline using Microsoft's text-based options
Activate Windows Server 2019 with KMS or the command line | TechTarget
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Pearson Correlation Coefficient
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Foster Heidenreich CPA

Last Updated:

Views: 6390

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Foster Heidenreich CPA

Birthday: 1995-01-14

Address: 55021 Usha Garden, North Larisa, DE 19209

Phone: +6812240846623

Job: Corporate Healthcare Strategist

Hobby: Singing, Listening to music, Rafting, LARPing, Gardening, Quilting, Rappelling

Introduction: My name is Foster Heidenreich CPA, I am a delightful, quaint, glorious, quaint, faithful, enchanting, fine person who loves writing and wants to share my knowledge and understanding with you.