Giter VIP home page Giter VIP logo

resin-image-manager's Introduction

resin-image-manager

npm version dependencies Build Status Build status

Join our online chat at Gitter chat

Manage device base operating systems resources with caching support.

Role

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.

Installation

Install resin-image-manager by running:

$ npm install --save resin-image-manager

Documentation

manager.get(slug) ⇒ Promise.<ReadStream>

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'))

manager.cleanCache() ⇒ Promise

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()

manager.pipeTemporal(stream) ⇒ Promise.<String>

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}")

Support

If you're having any problem, please raise an issue on GitHub and the Resin.io team will be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

$ gulp lint

License

The project is licensed under the Apache 2.0 license.

resin-image-manager's People

Contributors

jviotti avatar

Watchers

James Cloos avatar vulcanoIO - Open Source Sandbox and RE malwares avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.