Skip to main content

ZipUtils

Import :

const ZipUtils = brackets.getModule("utils/ZipUtils")

unzipBinDataToLocation(zipData, projectDir, flattenFirstLevel, [progressControlCallback]) ⇒ Promise

Extracts a given binary zip data array to a specified location.

Kind: global function
Returns: Promise - - A promise that resolves when extraction is complete.

ParamTypeDefaultDescription
zipDataUInt8ArrayBinary zip data.
projectDirstringDirectory to extract to.
flattenFirstLevelbooleanfalseIf set to true, then if zip contents are nested inside a directory, the nested directory will be removed in the path structure in the destination. For example, some zip may contain a contents folder inside the zip which has all the files. If we blindly extract the zip, all the contents will be placed inside a contents folder in the root instead of the root directory itself. See a sample zip file here: https://api.github.com/repos/StartBootstrap/startbootstrap-grayscales/zipball
[progressControlCallback]functionA function that can be used to view the progress and stop further extraction. The function will be invoked with (doneCount, totalCount). The function should return false if further extraction needs to be stopped. If nothing or true is returned, it will continue extraction.

zipFolder(fullPath) ⇒ Promise.<JSZip>

Zips a given folder located at path to a jsZip object.

Kind: global function
Returns: Promise.<JSZip> - zip object

ParamTypeDescription
fullPathstringto zip

unzipURLToLocation(url, projectDir, flattenFirstLevel) ⇒ Promise

Kind: global function

ParamDefaultDescription
urlthe zip fle URL
projectDirTo extract to
flattenFirstLevelfalseif set to true, then if zip contents are nested inside a directory, the nexted dir will be removed in the path structure in destination. For Eg. some Zip may contain a contents folder inside the zip which has all the contents. If we blindly extract the zio, all the contents will be placed inside a contents folder in root and not the root dir itself. See a sample zip file here: https://api.github.com/repos/StartBootstrap/startbootstrap-grayscales/zipball