@directus/storage-driver-gcs 11.0.0 → 11.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -7
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Driver,
|
|
1
|
+
import { Driver, ReadOptions } from '@directus/storage';
|
|
2
2
|
import { Readable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
type DriverGCSConfig = {
|
|
@@ -12,7 +12,7 @@ declare class DriverGCS implements Driver {
|
|
|
12
12
|
constructor(config: DriverGCSConfig);
|
|
13
13
|
private fullPath;
|
|
14
14
|
private file;
|
|
15
|
-
read(filepath: string,
|
|
15
|
+
read(filepath: string, options?: ReadOptions): Promise<Readable>;
|
|
16
16
|
write(filepath: string, content: Readable): Promise<void>;
|
|
17
17
|
delete(filepath: string): Promise<void>;
|
|
18
18
|
stat(filepath: string): Promise<{
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { normalizePath } from "@directus/utils";
|
|
3
3
|
import { Storage } from "@google-cloud/storage";
|
|
4
|
-
import { join } from "path";
|
|
5
|
-
import { pipeline } from "stream/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { pipeline } from "node:stream/promises";
|
|
6
6
|
var DriverGCS = class {
|
|
7
7
|
root;
|
|
8
8
|
bucket;
|
|
@@ -18,11 +18,12 @@ var DriverGCS = class {
|
|
|
18
18
|
file(filepath) {
|
|
19
19
|
return this.bucket.file(filepath);
|
|
20
20
|
}
|
|
21
|
-
async read(filepath,
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (range?.
|
|
25
|
-
|
|
21
|
+
async read(filepath, options) {
|
|
22
|
+
const { range } = options || {};
|
|
23
|
+
const stream_options = {};
|
|
24
|
+
if (range?.start) stream_options.start = range.start;
|
|
25
|
+
if (range?.end) stream_options.end = range.end;
|
|
26
|
+
return this.file(this.fullPath(filepath)).createReadStream(stream_options);
|
|
26
27
|
}
|
|
27
28
|
async write(filepath, content) {
|
|
28
29
|
const file = this.file(this.fullPath(filepath));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@directus/storage-driver-gcs",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.2",
|
|
4
4
|
"description": "GCS file storage abstraction for `@directus/storage`",
|
|
5
5
|
"homepage": "https://directus.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@google-cloud/storage": "7.
|
|
25
|
-
"@directus/
|
|
26
|
-
"@directus/
|
|
24
|
+
"@google-cloud/storage": "7.13.0",
|
|
25
|
+
"@directus/utils": "12.0.2",
|
|
26
|
+
"@directus/storage": "11.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@ngneat/falso": "7.2.0",
|
|
30
|
-
"@vitest/coverage-v8": "1.
|
|
31
|
-
"tsup": "8.
|
|
32
|
-
"typescript": "5.
|
|
33
|
-
"vitest": "1.
|
|
30
|
+
"@vitest/coverage-v8": "2.1.2",
|
|
31
|
+
"tsup": "8.3.0",
|
|
32
|
+
"typescript": "5.6.3",
|
|
33
|
+
"vitest": "2.1.2",
|
|
34
34
|
"@directus/tsconfig": "2.0.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|