Skip to content

metowolf/smms-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smms-cli

Author Version Travis License

Command-line Usage

Installation

npm install smms-cli -g

or

yarn global add smms-cli

asciicast

Usage

Upload a single image

smms dog.png

Upload multiple images (globbing supported)

smms "*.jpeg" dog.png
smms ~/*.(jpg|png|gif)

Delete image remote

smms --delete https://i.loli.net/2018/10/25/5bd1ce38cdec0.png
smms --delete OtE4waQ8erNikJ9

Show upload history

smms --list
smms --history

Clear upload history

smms --clear

Display smms-cli version:

smms --version

Module Usage

Installation

npm install smms-cli

or

yarn add smms-cli

API

https://sm.ms/doc/

Usage

Requiring the module:

const smms = require('smms-cli')

Uploading files

smms.upload('./test/nodejs.png')
    .then(json => {
        console.log(json)
    })
    .catch(err => {
        console.error(err.message)
    })

success response

{
    "code": "success",
    "data": {
        "width": 512,
        "height": 512,
        "filename": "nodejs.png",
        "storename": "5bcf14f27edca.png",
        "size": 6538,
        "path": "/2018/10/23/5bcf14f27edca.png",
        "hash": "IJsRz2bQpvPr4lA",
        "timestamp": 1540297970,
        "ip": "35.201.144.6",
        "url": "https://i.loli.net/2018/10/23/5bcf14f27edca.png",
        "delete": "https://sm.ms/delete/IJsRz2bQpvPr4lA"
    }
}

Upload history

smms.history()
    .then(json => {
        console.log(json.data)
    })
    .catch(err => {
        console.error(err.message)
    })

success response

{
    "code": "success",
    "data": [
        {
            "width": 512,
            "height": 512,
            "filename": "nodejs.png",
            "storename": "5bcf14f27edca.png",
            "size": 6538,
            "path": "/2018/10/23/5bcf14f27edca.png",
            "hash": "IJsRz2bQpvPr4lA",
            "timestamp": 1540297970,
            "ip": "35.201.144.6",
            "url": "https://i.loli.net/2018/10/23/5bcf14f27edca.png",
            "delete": "https://sm.ms/delete/IJsRz2bQpvPr4lA"
        }
    ]
}

Clear upload history

imgur.clear()
    .then(status => {
        console.log(status.msg);
    })
    .catch(err => {
        console.error(err.msg)
    })

Deleting upload

Delete an image based on the deletehash (generated during the image upload)

imgur.delete(hash)
    .then(status => {
        console.log(status.msg);
    })
    .catch(err => {
        console.error(err.msg)
    })

Author

smms-cli © metowolf, Released under the MIT License.

Blog @meto · GitHub @metowolf · Twitter @metowolf · Telegram Channel @metooooo

About

Upload images to sm.ms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published