-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
742 additions
and
78 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
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 |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { FileSystemAbstraction, fsa } from './fs.abstraction.js'; | ||
export { FsAwsS3 } from '@chunkd/source-aws'; | ||
export { FsHttp } from '@chunkd/source-http'; |
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
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 @@ | ||
tsconfig.tsbuildinfo |
Empty file.
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,15 @@ | ||
# @chunkd/source-gcp | ||
|
||
Load a chunks of a file from a AWS using `aws-sdk` | ||
|
||
## Usage | ||
|
||
```typescript | ||
import { SourceAwsS3 } from '@chunkd/source-google-cloud'; | ||
import { Storage } from '@google-cloud/storage'; | ||
|
||
const source = SourceGoogleStorage.fromUri('gs://bucket/path/to/cog.tif', new Storage()); | ||
|
||
// Load the first 1KB | ||
await source.fetchBytes(0, 1024); | ||
``` |
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,31 @@ | ||
{ | ||
"name": "@chunkd/source-google-cloud", | ||
"version": "8.2.0", | ||
"type": "module", | ||
"engines": { | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/blacha/chunkd.git", | ||
"directory": "packages/source-google-cloud" | ||
}, | ||
"author": "Blayne Chard", | ||
"main": "./build/index.js", | ||
"types": "./build/index.d.ts", | ||
"license": "MIT", | ||
"scripts": {}, | ||
"dependencies": { | ||
"@chunkd/core": "^8.2.0" | ||
}, | ||
"peerDependencies": { | ||
"@google-cloud/storage": "*" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/storage": "^5.19.4", | ||
"@types/node": "^16.11.7" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/source-google-cloud/src/__test__/gcp.source.test.ts
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,22 @@ | ||
import o from 'ospec'; | ||
import 'source-map-support/register.js'; | ||
import { SourceGoogleStorage } from '../gcp.source.js'; | ||
import { Storage } from '@google-cloud/storage'; | ||
|
||
o.spec('SourceGoogleStorage', () => { | ||
const fakeRemote = new Storage(); | ||
|
||
o('should round trip uri', () => { | ||
o(SourceGoogleStorage.fromUri('gs://foo/bar.tiff', fakeRemote)?.uri).equals('gs://foo/bar.tiff'); | ||
o(SourceGoogleStorage.fromUri('gs://foo/bar/baz.tiff', fakeRemote)?.uri).equals('gs://foo/bar/baz.tiff'); | ||
|
||
// No Key | ||
o(SourceGoogleStorage.fromUri('gs://foo', fakeRemote)).equals(null); | ||
|
||
// No Bucket | ||
o(SourceGoogleStorage.fromUri('gs:///foo', fakeRemote)).equals(null); | ||
|
||
// Not s3 | ||
o(SourceGoogleStorage.fromUri('http://example.com/foo.tiff', fakeRemote)).equals(null); | ||
}); | ||
}); |
Oops, something went wrong.