Skip to content

Commit 7508685

Browse files
author
Mark Williams
committed
LIMS-2042: Remove zlibjs
1 parent 09d38b3 commit 7508685

File tree

5 files changed

+18
-32
lines changed

5 files changed

+18
-32
lines changed

client/package-lock.json

Lines changed: 1 addition & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@
9696
"vee-validate": "^2.2.15",
9797
"vue": "^2.6.10",
9898
"vue-router": "^3.4.3",
99-
"vuex": "^3.5.1",
100-
"zlibjs": "^0.1.7"
99+
"vuex": "^3.5.1"
101100
},
102101
"engines": {
103102
"node": "^18.0.0"

client/src/js/modules/dc/views/mapmodelview.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
define(['marionette',
2-
'uglymol', 'gzip',
2+
'uglymol',
33
'modules/dc/collections/downstreams',
44
'modules/dc/collections/dimplepeaks',
55
'modules/dc/views/dimplepeaktable',
66
'templates/dc/mapmodelview.html',
77
"./uglymolhelper"
8-
], function(Marionette, Uglymol, zlib,
8+
], function(Marionette, Uglymol,
99
DownStreams, DIMPLEPeaks, DIMPLEPeakTable, template, defaultViewerOptions) {
1010

1111
return Marionette.LayoutView.extend({
@@ -42,14 +42,15 @@ define(['marionette',
4242
doLoadMaps: function(id, cb) {
4343
var self = this
4444
var xhr = this.xhrWithStatus('Downloading Map '+id)
45-
xhr.onload = function() {
45+
xhr.onload = async function() {
4646
if (xhr.status == 0 || xhr.status != 200) {
4747
this.onerror(xhr.status)
4848

4949
} else {
50-
var gunzip = new zlib.Zlib.Gunzip(new Uint8Array(this.response))
51-
var plain = gunzip.decompress()
52-
self.viewer.load_map_from_buffer(plain.buffer, { format: 'ccp4', diff_map: id == 2 })
50+
const ds = new DecompressionStream('gzip')
51+
const stream = new Response(this.response).body.pipeThrough(ds)
52+
const plain = await new Response(stream).arrayBuffer()
53+
self.viewer.load_map_from_buffer(plain, { format: 'ccp4', diff_map: id == 2 })
5354
}
5455

5556
self.mapsLoaded++

client/src/js/modules/dc/views/reciprocalview.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
define(['marionette',
22
'collections/attachments',
3-
'uglymol', 'gzip',
3+
'uglymol',
44
'templates/dc/mapmodelview.html',
5-
"./uglymolhelper"], function(Marionette, Attachments, Uglymol, zlib,
5+
"./uglymolhelper"], function(Marionette, Attachments, Uglymol,
66
template, defaultViewerOptions) {
77

88
return Marionette.LayoutView.extend({
@@ -23,7 +23,6 @@ define(['marionette',
2323
res: 'select[name=residue]',
2424
},
2525

26-
2726
loadData: function() {
2827
if (!this.attachments.length) {
2928
this.ui.hud.text('No reciprocal space data for this datacollection')
@@ -32,14 +31,14 @@ define(['marionette',
3231

3332
var xhr = this.xhrWithStatus('Downloading Reciprocal Space Data')
3433
var self = this
35-
36-
xhr.onload = function() {
37-
var gunzip = new zlib.Zlib.Gunzip(new Uint8Array(this.response))
38-
var plain = gunzip.decompress()
39-
var url = URL.createObjectURL(new Blob([plain], {type: 'text'}))
34+
35+
xhr.onload = async function () {
36+
const ds = new DecompressionStream('gzip')
37+
const stream = new Response(this.response).body.pipeThrough(ds)
38+
const plain = await new Response(stream).arrayBuffer()
39+
const url = URL.createObjectURL(new Blob([plain], {type: 'text'}))
4040
self.viewer.load_data(url)
4141
}
42-
4342

4443
var attachment = this.attachments.at(0)
4544
xhr.open('GET', app.apiurl+'/download/attachment/id/'+this.model.get('ID')+'/aid/'+attachment.get('DATACOLLECTIONFILEATTACHMENTID'))
@@ -76,4 +75,4 @@ define(['marionette',
7675
})
7776

7877

79-
})
78+
})

client/webpack.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ module.exports = (env, argv) => ({
6666
// heatmap in npm has dependency on canvas/node-gyp... so use old one for now
6767
heatmap: 'vendor/hmap',
6868

69-
// gunzip is actually the zlib library
70-
// https://npm.taobao.org/package/zlibjs
71-
gzip: 'zlibjs/bin/gunzip.min',
72-
7369
markdown: 'markdown/lib/markdown',
7470

7571
// Vue packages from npm (vee-validate requires promise polyfill - also npm)

0 commit comments

Comments
 (0)