Skip to content

Commit

Permalink
Add os download wifi example
Browse files Browse the repository at this point in the history
  • Loading branch information
jviotti committed Dec 2, 2015
1 parent 6b34982 commit a0cdd64
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
18 changes: 18 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1347,22 +1347,40 @@ resin.models.environmentVariables.isSystemVariable({

**Example**
```js
// Ethernet
var parameters = {
network: 'ethernet',
appId: 91
};

// Wifi
var parameters = {
network: 'wifi',
wifiSsid: 'ssid',
wifiKey: 'secret',
appId: 91
};

resin.models.os.download(parameters).then(function(stream) {
stream.pipe(fs.createWriteStream('foo/bar/image.img'));
});
```
**Example**
```js
// Ethernet
var parameters = {
network: 'ethernet',
appId: 91
};

// Wifi
var parameters = {
network: 'wifi',
wifiSsid: 'ssid',
wifiKey: 'secret',
appId: 91
};

resin.models.os.download(parameters, function(error, stream) {
if (error) throw error;
stream.pipe(fs.createWriteStream('foo/bar/image.img'));
Expand Down
18 changes: 18 additions & 0 deletions build/models/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,39 @@ THE SOFTWARE.
* @todo In the future this function should only require a device type slug.
*
* @example
* // Ethernet
* var parameters = {
* network: 'ethernet',
* appId: 91
* };
*
* // Wifi
* var parameters = {
* network: 'wifi',
* wifiSsid: 'ssid',
* wifiKey: 'secret',
* appId: 91
* };
*
* resin.models.os.download(parameters).then(function(stream) {
* stream.pipe(fs.createWriteStream('foo/bar/image.img'));
* });
*
* @example
* // Ethernet
* var parameters = {
* network: 'ethernet',
* appId: 91
* };
*
* // Wifi
* var parameters = {
* network: 'wifi',
* wifiSsid: 'ssid',
* wifiKey: 'secret',
* appId: 91
* };
*
* resin.models.os.download(parameters, function(error, stream) {
* if (error) throw error;
* stream.pipe(fs.createWriteStream('foo/bar/image.img'));
Expand Down
18 changes: 18 additions & 0 deletions lib/models/os.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,39 @@ request = require('resin-request')
# @todo In the future this function should only require a device type slug.
#
# @example
# // Ethernet
# var parameters = {
# network: 'ethernet',
# appId: 91
# };
#
# // Wifi
# var parameters = {
# network: 'wifi',
# wifiSsid: 'ssid',
# wifiKey: 'secret',
# appId: 91
# };
#
# resin.models.os.download(parameters).then(function(stream) {
# stream.pipe(fs.createWriteStream('foo/bar/image.img'));
# });
#
# @example
# // Ethernet
# var parameters = {
# network: 'ethernet',
# appId: 91
# };
#
# // Wifi
# var parameters = {
# network: 'wifi',
# wifiSsid: 'ssid',
# wifiKey: 'secret',
# appId: 91
# };
#
# resin.models.os.download(parameters, function(error, stream) {
# if (error) throw error;
# stream.pipe(fs.createWriteStream('foo/bar/image.img'));
Expand Down

0 comments on commit a0cdd64

Please sign in to comment.