fs-extra#chmod TypeScript Examples
The following examples show how to use
fs-extra#chmod.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppImageUpdater.ts From electron-differential-updater with MIT License | 5 votes |
/*** @private */
protected doDownloadUpdate(downloadUpdateOptions: DownloadUpdateOptions): Promise<Array<string>> {
const provider = downloadUpdateOptions.updateInfoAndProvider.provider
const fileInfo = findFile(provider.resolveFiles(downloadUpdateOptions.updateInfoAndProvider.info), "AppImage")!!
return this.executeDownload({
fileExtension: "AppImage",
fileInfo,
downloadUpdateOptions,
task: async (updateFile, downloadOptions) => {
const oldFile = process.env.APPIMAGE!!
if (oldFile == null) {
throw newError("APPIMAGE env is not defined", "ERR_UPDATER_OLD_FILE_NOT_FOUND")
}
let isDownloadFull = false
try {
await new FileWithEmbeddedBlockMapDifferentialDownloader(fileInfo.info, this.httpExecutor, {
newUrl: fileInfo.url,
oldFile,
logger: this._logger,
newFile: updateFile,
isUseMultipleRangeRequest: provider.isUseMultipleRangeRequest,
requestHeaders: downloadUpdateOptions.requestHeaders,
})
.download()
}
catch (e) {
this._logger.error(`Cannot download differentially, fallback to full download: ${e.stack || e}`)
// during test (developer machine mac) we must throw error
isDownloadFull = process.platform === "linux"
}
if (isDownloadFull) {
await this.httpExecutor.download(fileInfo.url, updateFile, downloadOptions)
}
await chmod(updateFile, 0o755)
},
})
}