Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aqzhyi/html-img-digger
Img elements as plain-object extract from html-string.
https://github.com/aqzhyi/html-img-digger
Last synced: about 1 month ago
JSON representation
Img elements as plain-object extract from html-string.
- Host: GitHub
- URL: https://github.com/aqzhyi/html-img-digger
- Owner: Aqzhyi
- Created: 2015-07-01T07:00:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-01T07:01:21.000Z (over 9 years ago)
- Last Synced: 2024-04-18T14:13:20.503Z (8 months ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# html-img-digger
## Usage
#### Basic
```js
import digger from 'html-img-digger'let tpl = '
'
let images = digger.dig(tpl)
```> images
```js
[
{
url: 'http://placehold.it/350x150',
alt: '',
},
]
```#### Download remote images (size digs, but slower)
```js
'
let tpl = '
let images = digger.dig(tpl, { remote: true })
```> images
```js
[
{
url: 'http://placehold.it/350x150',
alt: '',
width: 350,
height: 150,
},
]
```## Development
```sh
npm run dev
```## Test
```sh
npm test
``````
dig()
✓ 從傳入的 htmlString 中,採集出 img 物件們
✓ 允許遠端採集圖片寬與高(using http request) (651ms)
```