multer-storage-imgur

Multer storage engine for imgur. Images upload through multer will directly upload to Imgur

Usage no npm install needed!

<script type="module">
  import multerStorageImgur from 'https://cdn.skypack.dev/multer-storage-imgur';
</script>

README

multer-storage-imgur

npm version Dependency Status DevDependency Status

This will upload using multer directly to Imgur

Installation

$ npm install --save multer-storage-imgur

Usage

const ImgurStorage = require('multer-storage-imgur');
const multer = require('multer');

const upload = multer({
  storage: ImgurStorage({ clientId: 'INPUT_YOUR_IMGUR_CLIENTID' })
})

After the file is uploaded to Imgur, the reponse json from Imgur will be appended to the file object like this:

\\ req
{
...
file: {
    fieldname: 'img',
    originalname: 'img2.jpg',
    encoding: '7bit',
    mimetype: 'image/jpeg',
    data: {
        id: 'LnMoaHr',
        title: null,
        description: null,
        datetime: 1493549597,
        type: 'image/jpeg',
        animated: false,
        width: 564,
        height: 423,
        size: 9767,
        views: 0,
        bandwidth: 0,
        vote: null,
        favorite: false,
        nsfw: null,
        section: null,
        account_url: null,
        account_id: 0,
        is_ad: false,
        tags: [],
        in_most_viral: false,
        in_gallery: false,
        deletehash: 'XBizK4Enq1n7Fze',
        name: '',
        link: 'http://i.imgur.com/LnMoaHr.jpg'
    },
    success: true,
    status: 200}
}