A library to upload images from NodeJS
The API of this library is inspired by https://imgur.com
Using npm
npm install --save @acciosolutions/imagesUsing yarn
yarn add @acciosolutions/imagesYou need import the AccioClient from library
import { AccioClient } from "@acciosolutions/images";import AccioClient from "@acciosolutions/images";const AccioClient = require("@acciosolutions/images");const { AccioClient } = require("@acciosolutions/images");You need setup the AccioClient with ClientID and ClientSecret
const client = new AccioClient({
clientId: string;
clientSecret: string;
})- [ AccioClient uploadFromPath() ] (https://github.com/acciosolutions/images-sdk#AccioClient.uploadFromPath)
Usage
const file = path.resolve(__dirname, "image.png");
const response: UploadResponse = await client.uploadFromPath(file);interface UploadResponse {
deleteHash: string;
uuid: string;
url: string;
directUrl: string;
createdAt: string;
updatedAt: string;
}@acciosolutions/images is released under the MIT license.