Just wanted let everyone know about the newest package in the Socialize set, socialize:cloudinary, which I have just published to Atmosphere. While there are many cloudinary packages on Atmosphere, each one of them have issues that make them less desirable.
The things that make socialize:cloudinary better:
- Written using ES modules
- Uses best practices such as not explicitly depending on npm packages through Npm.depends()
- Fully up to date with the latest cloudinary releases
- Standardized Cloudinary API across server and client
- No dependence on extraneous packages
- Fully promisified API allowing use of async/await (This is the best feature)
import { Cloudinary } from 'socialize:cloudinary';
class Uploader extends Component {
onChange = (e) => {
const uploads = Cloudinary.uploadFiles(e.currentTarget.files);
uploads.forEach(async (response) => {
const photoData = await response;
console.log(photoData); //do something with the response data here
});
}
render() {
return (
<input type="file" accept="image/*" multiple onChange={this.onChange} />
);
}
}
Hope you guys find this useful