-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #589 from terascope/fix-loading-of-lz4
v2.0.2 - Defer loading of lz4 module (to fix error handling)
- Loading branch information
Showing
7 changed files
with
31 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "file", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "A set of processors for exporting data to files" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "file-assets-bundle", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Teraslice processors for working with data stored in files on disk", | ||
"repository": "https://github.com/terascope/file-assets.git", | ||
"author": "Terascope, LLC <[email protected]>", | ||
|
@@ -17,6 +17,7 @@ | |
"build:watch": "tsc --build --watch", | ||
"lint": "eslint --ignore-path .gitignore --ext .js,.ts .", | ||
"lint:fix": "yarn lint --fix", | ||
"setup": "yarn && yarn build --force", | ||
"test": "jest", | ||
"test:all": "yarn workspaces run test", | ||
"test:watch": "jest --coverage=false --notify --watch --onlyChanged", | ||
|
@@ -26,7 +27,7 @@ | |
"dependencies": {}, | ||
"devDependencies": { | ||
"@terascope/eslint-config": "^0.5.5", | ||
"@terascope/file-asset-apis": "^0.4.1", | ||
"@terascope/file-asset-apis": "^0.4.2", | ||
"@terascope/job-components": "^0.48.4", | ||
"@types/fs-extra": "^9.0.9", | ||
"@types/jest": "^26.0.22", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// @ts-expect-error | ||
import lz4init from 'lz4-asm/dist/lz4asm'; | ||
|
||
export interface LZ4 { | ||
compress(data: Buffer): Promise<Buffer>; | ||
decompress(data: Buffer|string): Buffer; | ||
} | ||
|
||
const lz4Module = {}; | ||
let lz4js: LZ4|undefined; | ||
|
||
export async function getLZ4(): Promise<LZ4> { | ||
if (lz4js) return lz4js; | ||
|
||
const lz4Ready = lz4init(lz4Module); | ||
lz4js = (await lz4Ready).lz4js; | ||
return lz4js!; | ||
} |