smmsx

interfaces of sm.ms

Usage no npm install needed!

<script type="module">
  import smmsx from 'https://cdn.skypack.dev/smmsx';
</script>

README

smmsx

图床服务 sm.ms 的 nodejs 接口 An interface of nodejs to sm.ms

Document

使用 resize 需系统先安装 GraphicsMagick 或者 ImageMagick, 请参考 http://aheckmann.github.io/gm/

Example

const smmsx = require('smmsx');
// ES6, ES7
(async()=>{
    // resize
    const source = 'https://tu.66vod.net/2017/8270.jpg';
    const dist = '/tmp/image_thumb' + (new Date().gettime()) + Math.random() + '.jpg';
    const width = 200,
        height = null;
    await smmsx.resize(source, dist, width, height);
    // upload
    const result = await smmsx.upload(dist);
    console.log(result);
})();