1.0.0 • Published 8 years ago

uploadcare-multi-upload v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

uploadcare-multi-upload

Upload multiple images at once with Uploadcare REST API.

Install

npm install uploadcare-multi-upload --save

Usage

Grab your public and secret keys from project's page.

import uploadcareMultiUpload from 'uploadcare-multi-upload'

const multiUpload = uploadcareMultiUpload('YOUR_PUBLIC_KEY', 'YOUR_SECRET_KEY')
const images = [
	{
		id: 1,
		src: 'http://placekitten.com/300/200',
	},
	{
		id: 2,
		src: 'http://placekitten.com/600/400',
	},
]
const onSuccessUpload = (image) => {
	console.log(JSON.stringify(image))
}

const onFailUpload = (image, error) => {
	console.log('error ', image, error)
}

multiUpload.fromUrls(images, 'src', onSuccessUpload, onFailUpload)
		.then(() => console.log('All images uploaded')