-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Closed
Labels
questionIssues that look for answers.Issues that look for answers.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.
Description
Hi, I'm looking for a good solution to be able to detect if this feature exists in the runtime my module is running on so I can throw if it's not supported. It was suggested on IRC to make an issue here.
I originally thought perhaps if I just construct a duplex stream and pass it into tls.connect
, but it doesn't seem to throw an error on pre-1.4.1 versions. Suggestions?
// This doesn't seem to work
var supportswrappedjsstreams = (function(){
var s = require("stream").Duplex();s._read=s._write=function(){};
try { require("tls").connect({ stream: s }); return true; } catch { return false; }
});
// This does work, but not sure if this is going to suddenly break in the future
var supportswrappedjsstreams = (function(){
try { require("_stream_wrap"); return true; } catch { return false; }
});
Metadata
Metadata
Assignees
Labels
questionIssues that look for answers.Issues that look for answers.tlsIssues and PRs related to the tls subsystem.Issues and PRs related to the tls subsystem.