new Osmosis(url, params)
Unless called with `new`, Osmosis will start automatically.
To start an instance created with `new`, use Osmosis.run.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
url |
string | contextCallback | A URL | |
params |
object |
<optional> |
GET query parameters |
- See:
-
- Command.run
Returns:
Command
Example
// These instances start immediately
osmosis.get('http://example.com');
osmosis('http://example.com');
// These instances need started
instance = new osmosis.get('http://example.com');
instance.run();
instance = new osmosis('http://example.com');
instance.run();
Members
-
options Osmosis and needle options.
-
Properties:
Name Type Description acceptstring HTTP Accept header compressedbool Compress HTTP requests concurrencynumber Number of simultaneous HTTP requests decode_responsebool Decode compressed HTTP responses follownumber Number of redirects to follow follow_set_cookiesbool Set cookies for redirects follow_set_refererbool Set referer header for redirects keep_databool Keep raw HTTP data in context.response.data timeoutbool HTTP request timeout triesbool HTTP request retries user_agentbool HTTP user agent
Methods
-
config(option, value)
-
Configure global Osmosis options.
Parameters:
Name Type Argument Description optionstring | object A string `key` or an object of { key: value } pairs. valueany <optional>
A value for the `key` - See:
-
- Command.config
- Osmosis.options
-
run()
-
Run (or re-run) an Osmosis instance. If you frequently use the same Osmosis instance (such as in an Express server), it's much more efficient to initialize the instance once and repeatedly use `run` as needed.
- See:
-
- Command.run