This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

resin-zip-image

1.1.2 • Public • Published

resin-zip-image

Resin.io Zip image manipulation utilities

npm version dependencies Build Status Build status Gitter

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>

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 = require('resin-zip-image')
 
imageEntries = zipImage.getImageEntries('path/to/archive.zip')
 
imageEntries.forEach (imageEntry) ->
  console.log(imageEntry.name)
  console.log(imageEntry.size)

zip.isValidZipImage(zip) ⇒ Boolean

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 = require('resin-zip-image')
 
if zipImage.isValidZipImage('path/to/archive.zip')
  console.log('This is a Zip image!')

zip.extractImage(zip) ⇒ Promise

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 = require('resin-zip-image')
 
zipImage.extractImage('path/to/archive.zip').then (stream) ->
  stream.pipe(fs.createWriteStream('output.img'))

zip.isZip(file) ⇒ Boolean

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 = require('resin-zip-image')
 
if zipImage.isZip('path/to/file')
  console.log('This file is a Zip archive!')

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.

Readme

Keywords

Package Sidebar

Install

npm i resin-zip-image

Weekly Downloads

2

Version

1.1.2

License

Apache-2.0

Last publish

Collaborators

  • balena.io