1.1.5 • Published 2 years ago

imgur-anonymous-uploader v1.1.5

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

imgur-anonymous-uploader

npm version

Imgur anonymous image uploder. This is Simple and Easy.

Install

npm install imgur-anonymous-uploader
# or
yarn add imgur-anonymous-uploader

Usage

const ImgurAnonymousUploader = require('imgur-anonymous-uploader');

(async () => {
  try {
    const uploader = new ImgurAnonymousUploader('Your imgur client id');
    const uploadResponse = await uploader.upload('upload file path');
    console.log(uploadResponse);
    /*
      {
        success: true,
        status: 200,
        url: 'uploaded imgur url',
        deleteHash: 'delete hash'
      }
    */

    const deleteResponse = await uploader.delete('delete hash is here');
    console.log(deleteResponse);
    // { success: true, status: 200 }
  } catch (error) {
    console.error(error);
  }
})();

Examples

Test image upload

./examples/testimg.png will be uploaded.

If you want to upload your file, please modify the source code.

IMGUR_CLIENT_ID={your imgur client id} node examples/upload.js

Test image buffer upload

If you want to upload an image buffer, see the example here.

./examples/testimg.base64 will be uploaded.

If you want to upload your file, please modify the source code.

IMGUR_CLIENT_ID={your imgur client id} node examples/upload-buffer.js

Delete uploaded image

Add deletehash to the source code before running it.

IMGUR_CLIENT_ID={your imgur client id} node examples/delete.js

Test

Use imgur client id.

IMGUR_CLIENT_ID={Your imgur client id} npm run test

Supported Files

Supported file extensions

  • JPEG
  • PNG
  • GIF
  • APNG
  • TIFF
  • MP4
  • MPEG
  • AVI
  • WEBM
  • quicktime
  • x-matroska
  • x-flv
  • x-msvideo
  • x-ms-wmv

The maximum file size

  • The maximum file size for non-animated images is 10MB
  • The maximum file size for animated images (like GIFs) and video is 200MB.

Reference(imgur - help)

What files can I upload? What is the size limit? - imgur help

Imgur API - POST Image Upload

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.1.0

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago