Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hill-98/mpv-javascript-http
Http client for mpv javascript scripts (based on curl)
https://github.com/hill-98/mpv-javascript-http
javascript mpv mpv-script
Last synced: 23 days ago
JSON representation
Http client for mpv javascript scripts (based on curl)
- Host: GitHub
- URL: https://github.com/hill-98/mpv-javascript-http
- Owner: Hill-98
- License: gpl-3.0
- Created: 2022-10-19T15:38:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-15T15:45:49.000Z (11 months ago)
- Last Synced: 2024-03-15T16:57:53.202Z (11 months ago)
- Topics: javascript, mpv, mpv-script
- Language: JavaScript
- Homepage:
- Size: 46.9 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mpv-javascript-http
Http client for mpv scripts (based on curl).
_Windows 10/11 already comes with `curl.exe` pre-installed, so it works on almost all platforms out of the box._
## Example
```javascript
'use strict';var msg = mp.msg;
var HttpClient = require('./HttpClient');var http = new HttpClient();
// Check if the system has curl
if (!HttpClient.available) {
msg.error('HTTP client unavailable!');
exit();
}http.get('https://jsonplaceholder.typicode.com/todos/1', function (err, res) {
if (err) {
msg.error(err);
return;
}
dump(res.data.id); // Auto parse json data
dump(res.headers);
dump(res.raw_data);
dump(res.status_code);
});
```