Manage device base operating systems resources with caching support.
The intention of this module is to provide low level access to how a Resin.io device image is downloaded, cached and evaluated for freshness.
THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.
Install resin-image-manager by running:
$ npm install --save resin-image-manager- manager
- .get(slug) ⇒
Promise.<ReadStream> - .cleanCache() ⇒
Promise - .pipeTemporal(stream) ⇒
Promise.<String>
- .get(slug) ⇒
This function saves a copy of the downloaded image in the cache directory setting specified in resin-settings-client.
Kind: static method of manager
Summary: Get a device operating system image
Returns: Promise.<ReadStream> - image readable stream
Access: public
| Param | Type | Description |
|---|---|---|
| slug | String |
device type slug |
Example
manager.get('raspberry-pi').then (stream) ->
stream.pipe(fs.createWriteStream('foo/bar.img'))Useful to manually force an image to be re-downloaded.
Kind: static method of manager
Summary: Clean the saved images cache
Access: public
Example
manager.cleanCache()If the image is a zip directory, it's uncompressed to a temporal location.
Make you delete the temporal file after you're done with it.
Kind: static method of manager
Summary: Pipe image stream to a temporal location
Returns: Promise.<String> - temporal location
Access: public
| Param | Type | Description |
|---|---|---|
| stream | Stream |
image stream |
Example
manager.get('raspberry-pi').then (stream) ->
manager.pipeTemporal(stream)
.then (temporalPath) ->
console.log("The image was piped to #{temporalPath}")If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.
Run the test suite by doing:
$ gulp test- Issue Tracker: github.com/resin-io/resin-image-manager/issues
- Source Code: github.com/resin-io/resin-image-manager
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ gulp lintThe project is licensed under the MIT license.
