Download utils/image-load-url.js from aseli/quote-api: direct link, hf CLI and curl.
- Browser
- Download file 484 Bytes
-
https://huggingface.co/spaces/aseli/quote-api/resolve/main/utils/image-load-url.js
- Command line
-
hf download hf://spaces/aseli/quote-api/utils/image-load-url.js
-
curl -L -o image-load-url.js https://huggingface.co/spaces/aseli/quote-api/resolve/main/utils/image-load-url.js
484 Bytes
| const https = require('https') | |
| module.exports = (url, filter = false) => { | |
| return new Promise((resolve, reject) => { | |
| https.get(url, (res) => { | |
| if (filter && filter(res.headers)) { | |
| resolve(Buffer.concat([])) | |
| } | |
| const chunks = [] | |
| res.on('error', (err) => { | |
| reject(err) | |
| }) | |
| res.on('data', (chunk) => { | |
| chunks.push(chunk) | |
| }) | |
| res.on('end', () => { | |
| resolve(Buffer.concat(chunks)) | |
| }) | |
| }) | |
| }) | |
| } | |