resin-zip-image
Resin.io Zip image manipulation utilities
Role
The intention of this module is to provide low level utilities to work with Resin.io Zip images.
THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY.
Installation
Install resin-zip-image
by running:
$ npm install --save resin-zip-image
Documentation
- zip
- .getImageEntries(zip) ⇒
Array.<Object>
- .isValidZipImage(zip) ⇒
Boolean
- .extractImage(zip) ⇒
Promise
- .isZip(file) ⇒
Boolean
- .getImageEntries(zip) ⇒
Array.<Object>
zip.getImageEntries(zip) ⇒ This function returns an array of objects that represent the "image" files found in the zip archive.
Kind: static method of zip
Summary: Get Zip image entries
Returns: Array.<Object>
- image entries
Throws:
- Will throw if the zip is not a zip archive
Access: public
Param | Type | Description |
---|---|---|
zip | String |
zip file path |
Example
zipImage = imageEntries = zipImage imageEntries -> console console
Boolean
zip.isValidZipImage(zip) ⇒ A Zip is considered a Zip image if it contains only one
*.iso
or *.img
file.
It is still considered valid if it contains an image file and many other non-image files.
Kind: static method of zip
Summary: Check if a Zip is a Zip image
Returns: Boolean
- whether the zip is a zip image
Access: public
Param | Type | Description |
---|---|---|
zip | String |
zip file path |
Example
zipImage = if zipImage console
Promise
zip.extractImage(zip) ⇒ Kind: static method of zip
Summary: Extract the image file from a Zip image
Throws:
- Will throw if the zip is not a zip image
Access: public
Fulfil: ReadableStream
- image file
Param | Type | Description |
---|---|---|
zip | String |
zip file path |
Example
zipImage = zipImage -> stream
Boolean
zip.isZip(file) ⇒ Kind: static method of zip
Summary: Check if a file is a zip archive
Returns: Boolean
- whether the file is a zip archive
Access: public
Param | Type | Description |
---|---|---|
file | String |
file path |
Example
zipImage = if zipImage console
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
- Issue Tracker: github.com/resin-io/resin-zip-image/issues
- Source Code: github.com/resin-io/resin-zip-image
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.