depreciate jszip w/ native zlib compression
This commit is contained in:
parent
a628c50b32
commit
2b059eb0f9
@ -43,7 +43,6 @@
|
||||
"graphql": "^15.5.1",
|
||||
"idb": "^6.0.0",
|
||||
"jspdf": "^1.5.3",
|
||||
"jszip": "^3.5.0",
|
||||
"lodash": "^4.17.21",
|
||||
"node-fetch": "^2.6.1",
|
||||
"numbro": "^2.3.2",
|
||||
|
@ -1,24 +1,14 @@
|
||||
import fs from 'fs'
|
||||
import Jszip from 'jszip'
|
||||
import zlib from 'zlib'
|
||||
import Web3 from 'web3'
|
||||
|
||||
import networkConfig from '../../networkConfig'
|
||||
|
||||
const jszip = new Jszip()
|
||||
|
||||
export async function download({ name, directory, contentType }) {
|
||||
const path = `${directory}${name}.zip`.toLowerCase()
|
||||
const path = `${directory}${name}.gz`.toLowerCase()
|
||||
|
||||
const data = fs.readFileSync(path)
|
||||
const zip = await jszip.loadAsync(data)
|
||||
|
||||
const file = zip.file(
|
||||
path
|
||||
.replace(directory, '')
|
||||
.slice(0, -4)
|
||||
.toLowerCase()
|
||||
)
|
||||
|
||||
const content = await file.async(contentType)
|
||||
const content = zlib.inflateSync(data)
|
||||
|
||||
return content
|
||||
}
|
||||
|
@ -1,33 +1,19 @@
|
||||
import fs from 'fs'
|
||||
import Jszip from 'jszip'
|
||||
|
||||
const compressionConfig = {
|
||||
type: "nodebuffer",
|
||||
compression: "DEFLATE",
|
||||
compressionOptions: {
|
||||
level: 9
|
||||
}
|
||||
}
|
||||
|
||||
const fileConfig = {
|
||||
binary: true,
|
||||
compression: "DEFLATE"
|
||||
}
|
||||
import zlib from 'zlib'
|
||||
|
||||
export async function save(filePath) {
|
||||
const jszip = new Jszip()
|
||||
const directories = filePath.split('/')
|
||||
const fileName = directories[directories.length - 1]
|
||||
|
||||
try {
|
||||
const data = fs.readFileSync(`${filePath}`)
|
||||
|
||||
await jszip.file(`${fileName}`, data, fileConfig)
|
||||
await jszip.generateNodeStream({
|
||||
...compressionConfig,
|
||||
streamFiles: true
|
||||
const payload = await zlib.deflateSync(data, {
|
||||
level: zlib.constants.Z_BEST_COMPRESSION,
|
||||
strategy: zlib.constants.Z_FILTERED
|
||||
})
|
||||
.pipe(fs.createWriteStream(`${filePath}.zip`))
|
||||
|
||||
fs.writeFileSync(`${filePath}.gz`, payload)
|
||||
|
||||
return true
|
||||
} catch (err) {
|
||||
|
@ -45,7 +45,7 @@ function createTreeZip(netId) {
|
||||
|
||||
treesFolder.forEach((fileName) => {
|
||||
fileName = `${TREES_PATH}${fileName}`
|
||||
const isInstanceFile = !fileName.includes('.zip') && fileName.includes(baseFilename)
|
||||
const isInstanceFile = !fileName.includes('.gz') && fileName.includes(baseFilename)
|
||||
|
||||
if (isInstanceFile) {
|
||||
save(fileName)
|
||||
|
@ -123,7 +123,7 @@ class EventService {
|
||||
|
||||
const module = await download({
|
||||
contentType: 'string',
|
||||
name: `events/${instanceName}.json.zip`
|
||||
name: `events/${instanceName}.json.gz`
|
||||
})
|
||||
|
||||
if (module) {
|
||||
|
BIN
static/events/deposits_bnb_0.1.json.gz
Normal file
BIN
static/events/deposits_bnb_0.1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_bnb_1.json.gz
Normal file
BIN
static/events/deposits_bnb_1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_bnb_10.json.gz
Normal file
BIN
static/events/deposits_bnb_10.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_bnb_100.json.gz
Normal file
BIN
static/events/deposits_bnb_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_eth_0.1.json.gz
Normal file
BIN
static/events/deposits_eth_0.1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_eth_1.json.gz
Normal file
BIN
static/events/deposits_eth_1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_eth_10.json.gz
Normal file
BIN
static/events/deposits_eth_10.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_eth_100.json.gz
Normal file
BIN
static/events/deposits_eth_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_matic_100.json.gz
Normal file
BIN
static/events/deposits_matic_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_matic_1000.json.gz
Normal file
BIN
static/events/deposits_matic_1000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_matic_10000.json.gz
Normal file
BIN
static/events/deposits_matic_10000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_matic_100000.json.gz
Normal file
BIN
static/events/deposits_matic_100000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_xdai_100.json.gz
Normal file
BIN
static/events/deposits_xdai_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_xdai_1000.json.gz
Normal file
BIN
static/events/deposits_xdai_1000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_xdai_10000.json.gz
Normal file
BIN
static/events/deposits_xdai_10000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/deposits_xdai_100000.json.gz
Normal file
BIN
static/events/deposits_xdai_100000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/encrypted_notes_1.json.gz
Normal file
BIN
static/events/encrypted_notes_1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/encrypted_notes_100.json.gz
Normal file
BIN
static/events/encrypted_notes_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/encrypted_notes_137.json.gz
Normal file
BIN
static/events/encrypted_notes_137.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/encrypted_notes_5.json.gz
Normal file
BIN
static/events/encrypted_notes_5.json.gz
Normal file
Binary file not shown.
BIN
static/events/encrypted_notes_56.json.gz
Normal file
BIN
static/events/encrypted_notes_56.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_bnb_0.1.json.gz
Normal file
BIN
static/events/withdrawals_bnb_0.1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_bnb_1.json.gz
Normal file
BIN
static/events/withdrawals_bnb_1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_bnb_10.json.gz
Normal file
BIN
static/events/withdrawals_bnb_10.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_bnb_100.json.gz
Normal file
BIN
static/events/withdrawals_bnb_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_eth_0.1.json.gz
Normal file
BIN
static/events/withdrawals_eth_0.1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_eth_1.json.gz
Normal file
BIN
static/events/withdrawals_eth_1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_eth_10.json.gz
Normal file
BIN
static/events/withdrawals_eth_10.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_eth_100.json.gz
Normal file
BIN
static/events/withdrawals_eth_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_matic_100.json.gz
Normal file
BIN
static/events/withdrawals_matic_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_matic_1000.json.gz
Normal file
BIN
static/events/withdrawals_matic_1000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_matic_10000.json.gz
Normal file
BIN
static/events/withdrawals_matic_10000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_matic_100000.json.gz
Normal file
BIN
static/events/withdrawals_matic_100000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_xdai_100.json.gz
Normal file
BIN
static/events/withdrawals_xdai_100.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_xdai_1000.json.gz
Normal file
BIN
static/events/withdrawals_xdai_1000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_xdai_10000.json.gz
Normal file
BIN
static/events/withdrawals_xdai_10000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/events/withdrawals_xdai_100000.json.gz
Normal file
BIN
static/events/withdrawals_xdai_100000.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/tornado.json.gz
Normal file
BIN
static/tornado.json.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_0.1_bloom.json.gz
Normal file
BIN
static/trees/deposits_bnb_0.1_bloom.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_0.1_slice1.json.gz
Normal file
BIN
static/trees/deposits_bnb_0.1_slice1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_0.1_slice2.json.gz
Normal file
BIN
static/trees/deposits_bnb_0.1_slice2.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_0.1_slice3.json.gz
Normal file
BIN
static/trees/deposits_bnb_0.1_slice3.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_0.1_slice4.json.gz
Normal file
BIN
static/trees/deposits_bnb_0.1_slice4.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_100_bloom.json.gz
Normal file
BIN
static/trees/deposits_bnb_100_bloom.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_100_slice1.json.gz
Normal file
BIN
static/trees/deposits_bnb_100_slice1.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_100_slice2.json.gz
Normal file
BIN
static/trees/deposits_bnb_100_slice2.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_100_slice3.json.gz
Normal file
BIN
static/trees/deposits_bnb_100_slice3.json.gz
Normal file
Binary file not shown.
Binary file not shown.
BIN
static/trees/deposits_bnb_100_slice4.json.gz
Normal file
BIN
static/trees/deposits_bnb_100_slice4.json.gz
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user