@acciosolutions/images 中文文档教程

发布于 4年前 浏览 25 项目主页 更新于 3年前

@acciosolutions/images

NPM Module

一个从 NodeJS 上传图片的

库 这个库的 API 灵感来自 https://imgur.com

Dependency Status

Install

使用 npm

npm install --save @acciosolutions/images

使用 yarn

yarn add @acciosolutions/images

Usage

您需要从导入 AccioClient库

import { AccioClient } from "@acciosolutions/images";
import AccioClient from "@acciosolutions/images";
const AccioClient = require("@acciosolutions/images");
const { AccioClient } = require("@acciosolutions/images");

您需要使用 ClientID 和 ClientSecret 设置 AccioClient

const client = new AccioClient({
  clientId: string;
  clientSecret: string;
})

Methods

AccioClient uploadFromPath()

使用

const file = path.resolve(__dirname, "image.png");
const response: UploadResponse = await client.uploadFromPath(file);

Interfaces

interface UploadResponse {
  deleteHash: string;
  uuid: string;
  url: string;
  directUrl: string;
  createdAt: string;
  updatedAt: string;
}

License

@acciosolutions/images 是根据 MIT 许可证发布的。

@acciosolutions/images

NPM Module

A library to upload images from NodeJS

The API of this library is inspired by https://imgur.com

Dependency Status

Install

Using npm

npm install --save @acciosolutions/images

Using yarn

yarn add @acciosolutions/images

Usage

You 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;
})

Methods

AccioClient uploadFromPath()

Usage

const file = path.resolve(__dirname, "image.png");
const response: UploadResponse = await client.uploadFromPath(file);

Interfaces

interface UploadResponse {
  deleteHash: string;
  uuid: string;
  url: string;
  directUrl: string;
  createdAt: string;
  updatedAt: string;
}

License

@acciosolutions/images is released under the MIT license.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文