(data, encoding = GZIP_MARKER, callback)
| 217 | } |
| 218 | |
| 219 | async function compressData(data, encoding = GZIP_MARKER, callback) { |
| 220 | console.debug("Compressing with", encoding) |
| 221 | if (encoding == GZIP_MARKER) { |
| 222 | return compressDataGzip(data); |
| 223 | } else if (encoding == BROT_MARKER) { |
| 224 | |
| 225 | } else if (encoding == LZMA_MARKER) { |
| 226 | return new Promise(function(resolve, reject) { |
| 227 | LZMA.compress(data, 9, function(result, error) { |
| 228 | if (error) reject(error); |
| 229 | resolve(result); |
| 230 | }); |
| 231 | }); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | function stringToByteArray(string) { |
| 236 | return new TextEncoder().encode(string); |
no test coverage detected