mirror of
https://github.com/asadbek064/hyparquet.git
synced 2025-12-06 06:51:54 +00:00
Change compressors to return Uint8Array
This commit is contained in:
parent
b378bd85fd
commit
0f4708b954
@ -34,7 +34,7 @@
|
||||
"eslint-plugin-import": "2.29.1",
|
||||
"eslint-plugin-jsdoc": "48.2.0",
|
||||
"http-server": "14.1.1",
|
||||
"hysnappy": "0.2.0",
|
||||
"hysnappy": "0.3.0",
|
||||
"typescript": "5.3.3",
|
||||
"vitest": "1.3.1"
|
||||
}
|
||||
|
||||
@ -182,8 +182,7 @@ export function decompressPage(compressedBytes, uncompressed_page_size, codec, c
|
||||
if (codec === 'UNCOMPRESSED') {
|
||||
page = compressedBytes
|
||||
} else if (customDecompressor) {
|
||||
page = new Uint8Array(uncompressed_page_size)
|
||||
customDecompressor(compressedBytes, page)
|
||||
page = customDecompressor(compressedBytes, uncompressed_page_size)
|
||||
} else if (codec === 'SNAPPY') {
|
||||
page = new Uint8Array(uncompressed_page_size)
|
||||
snappyUncompress(compressedBytes, page)
|
||||
|
||||
2
src/types.d.ts
vendored
2
src/types.d.ts
vendored
@ -134,7 +134,7 @@ export type CompressionCodec =
|
||||
'LZ4_RAW'
|
||||
|
||||
export type Compressors = {
|
||||
[K in CompressionCodec]?: (input: Uint8Array, output: Uint8Array) => void
|
||||
[K in CompressionCodec]?: (input: Uint8Array, outputLength: number) => Uint8Array
|
||||
}
|
||||
|
||||
interface KeyValue {
|
||||
|
||||
@ -10,9 +10,9 @@ import { fileToAsyncBuffer, fileToJson } from './helpers.js'
|
||||
* @type {Compressors}
|
||||
*/
|
||||
const compressors = {
|
||||
GZIP: (/** @type {Uint8Array} */ input, /** @type {Uint8Array} */ output) => {
|
||||
GZIP: (/** @type {Uint8Array} */ input, /** @type {number} */ outputLength) => {
|
||||
const result = gunzipSync(input)
|
||||
output.set(result)
|
||||
return new Uint8Array(result.buffer, result.byteOffset, outputLength)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user