Class: BasePackager

BasePackager


new BasePackager( [keep])

Constructor
Parameters:
Name Type Argument Description
keep * <optional>
Array of valid source file extensions

Methods


findMetadataDescriptors(filePath)

Find the metadata descriptor files.
Parameters:
Name Type Description
filePath The top-level directory containing the metadata descriptors. Only files with a ".json" extension will be included in the results.
Returns:
Type
Promise

findSource(filepath)

Given an input 'filePath', recursively parse the filesystem for any files that fit the criteria for being valid chaincode source (ISREG + keep)
Parameters:
Name Type Description
filepath

generateTarGz(descriptors, dest)

Creates an .tar.gz stream from the provided descriptor entries
Parameters:
Name Type Description
descriptors
dest
Returns:
Type
Promise

isMetadata(filePath)

Predicate function for determining whether a given path should be considered a valid metadata descriptor based entirely on the file extension.
Parameters:
Name Type Description
filePath The top-level directory containing the metadata descriptors.
Returns:
Returns true for valid metadata descriptors.
Type
boolean

isSource(filePath)

Predicate function for determining whether a given path should be considered valid source code, based entirely on the extension. It is assumed that other checks for file type (e.g. ISREG) have already been performed.
Parameters:
Name Type Description
filePath
Returns:
Type
boolean

package(chaincodePath, metadataPath)

All of the files in the directory of request.chaincodePath will be included in an archive file.
Parameters:
Name Type Description
chaincodePath
metadataPath

<async> packEntry(pack, desc)

Given an {fqp, name} tuple, generate a tar entry complete with sensible header and populated contents read from the filesystem.
Parameters:
Name Type Description
pack
desc
Returns:
Type
Promise