GithubHelp home page GithubHelp logo

pic2smms's Introduction

pic2smms

to upload image to the smms picbed

how to install

npm i pic2smms

how to use

//to use it on your server
const upload = require('pic2smms');

async function test1() {
    let result = await upload('./1.png');
    console.log(result)
}
test1()
//if you are the vip or registered user, you can use the token to save the image for you account
const upload = require('pic2smms');

async function test2() {
    let result = await upload('./1.png', 'your token');
    console.log(result)
}
test2()
//get the result
const upload = require('pic2smms');

async function test3() {
    let result = await upload('./1.png');
    console.log(result.data)
}

test3()
//show the "console.log" data result
data: {
    success: true,
    code: 'success',
    message: 'Upload success.',
    data: {
      file_id: 0,
      width: 1000,
      height: 966,
      filename: '1.png',
      storename: 'xxxxxxx.png',
      size: 50116,
      path: '/2020/01/08/X284KvEH3xflntk.png',
      hash: 'xxxxxxx',
      url: 'https://i.loli.net/2020/01/08/xxxxxxx.png',
      delete: 'https://sm.ms/delete/xxxxxxx',
      page: 'https://sm.ms/image/xxxxxxx'
    },
    RequestId: 'xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx'
}
//To get result data, no use async, await
const upload = require('pic2smms');
let result = upload('./1.png');

result.then(data => {
  //show the data
  console.log(data.data);
})

pic2smms's People

Contributors

just4picbed avatar fhefh2018 avatar

Stargazers

坐和放宽 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.