0.0.39 • Published 8 days ago
pull-md-img v0.0.39
mdDownloadImg
- 下载markdown中的图片
- 更改markdown中的图片路径改为本地
- 根据
Content-Type
定义图片后缀 - 302, 301重定向下载重定向后的target
- 随机ua头
- 跳过markdown的本地图片
安装
npm install -g pull-md-img
pull-md-img -h
Usage: pull-md-img [options]
Options:
-V, --version output the version number
-p, --path <path> markdown 目标文件
-s, --suffix <suffix> 需要更改下载的图片的后缀的话 后缀(eg: -s jpg)
-d, --dir <path> 生成的目录(eg: -d res)
-i, --img-dir <path> 生成目录内图片目录(eg: -i ./img/20)
-h, --help output usage information
Examples:
$ custom-help --help
$ custom-help -h
nodejs中使用
const mdImg = require('pull-md-img')
const fs = require('fs')
const markdownText = '![xxx](https://pic3.zhimg.com/v2-fc83865f31f095893430a4dadb036a61_1440w.jpg)'
const distDir = 'dist'
mdImg.run(markdownText, {
// 下载完后保存的图片后缀
suffix: 'png',
dist: distDir,
imgDir: './img/1',
// 忽略进度展示
isIgnoreConsole: true
}).then((content) => {
console.log(content) // ![xxx](./img/1/v2-fc83865f31f095893430a4dadb036a61_1440w-38475.png)
fs.writeFileSync(`${distDir}/new.md`, content)
})
0.0.39
8 days ago
0.0.38
8 days ago
0.0.30
8 days ago
0.0.31
8 days ago
0.0.32
8 days ago
0.0.33
8 days ago
0.0.36
8 days ago
0.0.29
8 days ago
0.0.26
4 months ago
0.0.24
7 months ago
0.0.25
6 months ago
0.0.20
9 months ago
0.0.21
9 months ago
0.0.22
9 months ago
0.0.23
9 months ago
0.0.16
9 months ago
0.0.17
9 months ago
0.0.18
9 months ago
0.0.19
9 months ago
0.0.14
1 year ago
0.0.15
1 year ago
0.0.13
2 years ago
0.0.11
3 years ago
0.0.12
3 years ago
0.0.10
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago