You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
568 B
JavaScript
16 lines
568 B
JavaScript
7 years ago
|
var base64 = require('base64-js');
|
||
|
var fs = require('fs');
|
||
|
|
||
|
/**
|
||
|
* The normal dictionary-data.js is quite large, which makes it
|
||
|
* unsuitable for browser usage. In order to make it smaller,
|
||
|
* we read dictionary.bin, which is a compressed version of
|
||
|
* the dictionary, and on initial load, Brotli decompresses
|
||
|
* it's own dictionary. 😜
|
||
|
*/
|
||
|
exports.init = function() {
|
||
|
var BrotliDecompressBuffer = require('./decode').BrotliDecompressBuffer;
|
||
|
var compressed = base64.toByteArray(require('./dictionary.bin.js'));
|
||
|
return BrotliDecompressBuffer(compressed);
|
||
|
};
|