Skip to content

Instantly share code, notes, and snippets.

@jbis9051
Last active February 22, 2019 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbis9051/549afac745aa58210bb981c0d780c97a to your computer and use it in GitHub Desktop.
Save jbis9051/549afac745aa58210bb981c0d780c97a to your computer and use it in GitHub Desktop.
<div className={"right-align"}>
<Tool className={"confirm-btn"} icon={"fas fa-check"}
onClick={() => this.beginDownload()}/>
</div>
[...]
beginDownload() {
[...]
this.setState({downloads: [...this.state.downloads, new Download()]});
[...]
}
[...]
export default class Download {
constructor() {
[...]
new Promise(resolve => {
var options = {method: 'HEAD', host: 'stackoverflow.com', port: 443, path: '/'};
var req = https.request(options, function (res) {
console.log("in the request");
//console.log(res);
//resolve(res.headers['content-length']);
console.log(JSON.stringify(res.headers));
res.on("data",res => {
console.log(JSON.stringify(res));
})
}
);
req.end();
});
}
[...]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment