get https://api.osint.industries/v2/request/stream
Live result feed
Streamed Requests Configuration
Streamed requests require the use of a specific configuration to handle data as it is received incrementally. Below is an example of how to configure and handle streamed requests:
const url = 'https://api.osint.industries/v2/request/stream?type=email&timeout=5&[email protected]';
const options = { method: 'GET', headers: { accept: 'application/json', "api-key": "xxx"} };
fetch(url, options)
.then(res => res.body.getReader())
.then(reader => {
const decoder = new TextDecoder();
let buffer = '';
const results = [];
return reader.read().then(function process({ done, value }) {
if (done) {
if (buffer.trim()) {
results.push(buffer.trim());
}
return results;
}
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split('\n');
buffer = lines.pop();
lines.forEach(line => {
if (line.trim()) {
console.log(line)
results.push(line.trim());
}
});
return reader.read().then(process);
});
})
.catch(err => console.error('Error:', err));