multer-storage-imgur
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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}
}

Package Sidebar

Install

npm i multer-storage-imgur

Weekly Downloads

3

Version

1.0.4

License

MIT

Unpacked Size

182 kB

Total Files

11

Last publish

Collaborators

  • boylove142