etcher-image-stream
Get a readable stream from any type of OS image
Installation
Install etcher-image-stream
by running:
$ npm install --save etcher-image-stream
Documentation
- imageStream
- .supportedFileTypes :
Array.<String>
- .getFromFilePath(file) ⇒
Promise
- .getImageMetadata(file) ⇒
Promise
- .supportedFileTypes :
Array.<String>
imageStream.supportedFileTypes : Kind: static property of imageStream
Summary: Supported file types
Access: public
Example
const imageStream = ; imageStreamsupportedFileTypes;
Promise
imageStream.getFromFilePath(file) ⇒ This function resolves an object containing the following properties:
-
Number size
: The input file size. -
ReadableStream stream
: The input file stream. -
TransformStream transform
: A transform stream that performs any needed transformation to get the image out of the source input file (for example, decompression).
The purpose of separating the above components is to handle cases like showing a progress bar when you can't know the final uncompressed size.
In such case, you can pipe the stream
through a progress stream using
the input file size
, and apply the transform
after the progress stream.
Kind: static method of imageStream
Summary: Get an image stream from a file
Access: public
Fulfil: Object
- image stream details
Param | Type | Description |
---|---|---|
file | String |
file path |
Example
const imageStream = ; imageStream;
Promise
imageStream.getImageMetadata(file) ⇒ This function is useful to determine the final size of an image after decompression or any other needed transformation, as well as other relevent metadata, if any.
NOTE: This function is known to output incorrect size results for
bzip2
. For this compression format, this function will simply
return the size of the compressed file.
Kind: static method of imageStream
Summary: Get image metadata
Access: public
Fulfil: Object
- image metadata
Param | Type | Description |
---|---|---|
file | String |
file path |
Example
const imageStream = ; imageStream;
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:
$ npm test
Contribute
- Issue Tracker: github.com/resin-io-modules/etcher-image-stream/issues
- Source Code: github.com/resin-io-modules/etcher-image-stream
Before submitting a PR, please make sure that you include tests, and that jshint runs without any warning:
$ npm run lint
License
etcher-image-stream
is free software, and may be redistributed under the terms specified in the license.