2.0.6 • Published 5 years ago

@thewhodidthis/upload v2.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
5 years ago

Helps store images on imgur

Setup

# Fetch latest from github
npm i thewhodidthis/upload

# Try example
CLIENT_ID=*** node node_modules/@thewhodidthis/upload/example

Usage

const fs = require('fs')
const upload = require('@thewhodidthis/upload')(process.env.CLIENT_ID)

const uploadCallback = (error, body, { headers }) => {
  if (error) {
    console.error(error)
  } else {
    const { data } = JSON.parse(body)

    console.log('Result', data)
    console.log('Headers', headers)
  }
}

fs.readFile(`${__dirname}/my.jpg`, (error, image) => {
  if (error) {
    return
  }

  upload(image.toString('base64'), uploadCallback)
})
2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago