-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: expose internal chunk and fetchable as npm packages (#641)
* refactor: expose `@cogeotiff/chunk` * refactor: use stronger lint settings * refactor: remove more unused code * refactor: remove `@cogeotiff/core` from sources * refactor: dead code removal * refactor: dead code removal * refactor: ensure the logger is passed arround * refactor: cleanup names, update docs * refactor: remove unused files * refactor: add git location and author to packages * refactor: correct naming of fetchBytes
- Loading branch information
Showing
81 changed files
with
2,144 additions
and
2,166 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,16 +1,3 @@ | ||
module.exports = { | ||
parser: "@typescript-eslint/parser", | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
"plugin:prettier/recommended" | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module" | ||
}, | ||
rules: { | ||
"@typescript-eslint/explicit-member-accessibility" : "off", | ||
"@typescript-eslint/explicit-function-return-type": "off" | ||
} | ||
}; | ||
...require('@linzjs/style/.eslintrc.js'), | ||
}; |
This file was deleted.
Oops, something went wrong.
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,7 +1,4 @@ | ||
module.exports = { | ||
semi: true, | ||
trailingComma: "all", | ||
singleQuote: true, | ||
printWidth: 120, | ||
...require('@linzjs/style/.prettierrc.js'), | ||
tabWidth: 4 | ||
}; | ||
}; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,32 +1,26 @@ | ||
{ | ||
"name": "@cogeotiff/base", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"clean": "tsc -b --clean && rimraf 'packages/*/build'", | ||
"build": "tsc -b --pretty", | ||
"build-watch": "tsc -b --pretty --watch", | ||
"version": "lerna version --conventional-commits --no-push --sign-git-commit --sign-git-tag", | ||
"lint": "eslint 'packages/*/{src,test}/**/*.{js,ts,tsx}' --quiet --fix", | ||
"test": "ospec packages/*/build/**/*.test.js" | ||
}, | ||
"private": true, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^4.0.1", | ||
"@typescript-eslint/parser": "^4.0.1", | ||
"eslint": "^7.8.1", | ||
"eslint-config-prettier": "^7.1.0", | ||
"eslint-plugin-prettier": "^3.1.0", | ||
"lerna": "^3.16.4", | ||
"ospec": "^4.0.0", | ||
"prettier": "^2.1.1", | ||
"rimraf": "^3.0.0", | ||
"typescript": "^4.0.2" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
} | ||
"name": "@cogeotiff/base", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"clean": "tsc -b --clean && rimraf 'packages/*/build'", | ||
"build": "tsc -b --pretty", | ||
"build-watch": "tsc -b --pretty --watch", | ||
"version": "lerna version --conventional-commits --no-push --sign-git-commit --sign-git-tag", | ||
"lint": "eslint 'packages/*/{src,test}/**/*.{js,ts,tsx}' --quiet --fix", | ||
"test": "ospec packages/*/build/**/*.test.js" | ||
}, | ||
"private": true, | ||
"keywords": [], | ||
"author": "Blayne Chard", | ||
"license": "ISC", | ||
"description": "", | ||
"devDependencies": { | ||
"@linzjs/style": "^0.4.3", | ||
"lerna": "^3.16.4", | ||
"ospec": "^4.0.0", | ||
"rimraf": "^3.0.0" | ||
}, | ||
"workspaces": [ | ||
"packages/*" | ||
] | ||
} |
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,51 @@ | ||
# Chunked object reading | ||
|
||
Split up a file into chunks and then read the chunks as needed. | ||
|
||
## Example Sources | ||
- File - [@cogeotiff/source-file](https://www.npmjs.com/package/@cogeotiff/source-file) | ||
- AWS - [@cogeotiff/source-aws](https://www.npmjs.com/package/@cogeotiff/source-aws) | ||
- Url - [@cogeotiff/source-url](https://www.npmjs.com/package/@cogeotiff/source-url) | ||
|
||
### Example Usage | ||
Fetching Data | ||
```typescript | ||
const source = new SourceUrl('https://example.com/foo') | ||
// Read 1KB chunks | ||
source.chunkSize = 1024; | ||
|
||
// Read the first 2KB of the file, or two chunks of data, this will be one HTTP Range requests | ||
if (!source.hasBytes(0, 2048)) await source.loadBytes(0, 2048) | ||
|
||
const bytes = source.bytes(0, 2048); | ||
``` | ||
|
||
Fetching multiple ranges at the same time | ||
|
||
```typescript | ||
const source = new SourceUrl('https://example.com/foo') | ||
// Read 1KB chunks | ||
source.chunkSize = 1024; | ||
|
||
// Read in the first two KB and 1KB starting at 4KB | ||
// This will do one HTTP Range request for all of the data even though 2048-4096 has not been requested | ||
// Chunks 0 (0-1024), 1 (1024-2048), 2 (2048-3096) 3 (3096-4096) and 4 (4096 - 5120) will be fetched | ||
await Promise.all([ | ||
source.loadBytes(0, 2048), | ||
source.loadBytes(4096, 1024) | ||
]) | ||
|
||
const bytes = source.bytes(0, 5120); | ||
``` | ||
|
||
|
||
Reading raw bytes | ||
```typescript | ||
const source = new SourceUrl('https://example.com/foo') | ||
|
||
if (!source.hasBytes(0, 1024)) await source.loadBytes(0, 1024) | ||
// Read a UInt8 starting at offset 0 | ||
const firstNumber = source.uint8(0); | ||
// Read a buffer from offset 10, with length of 100 | ||
const firstBuffer = source.bytes(10, 100) | ||
``` |
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,19 @@ | ||
{ | ||
"name": "@cogeotiff/chunk", | ||
"version": "3.1.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/blacha/cogeotiff.git", | ||
"directory": "packages/chunk" | ||
}, | ||
"author": "Blayne Chard", | ||
"main": "./build/index.js", | ||
"types": "./build/index.d.ts", | ||
"license": "MIT", | ||
"scripts": {}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
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
Oops, something went wrong.