@memberjunction/storage 2.38.0 → 2.40.0
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/drivers/AWSFileStorage.d.ts +360 -4
- package/dist/drivers/AWSFileStorage.d.ts.map +1 -1
- package/dist/drivers/AWSFileStorage.js +357 -4
- package/dist/drivers/AWSFileStorage.js.map +1 -1
- package/dist/drivers/AzureFileStorage.d.ts +362 -2
- package/dist/drivers/AzureFileStorage.d.ts.map +1 -1
- package/dist/drivers/AzureFileStorage.js +357 -2
- package/dist/drivers/AzureFileStorage.js.map +1 -1
- package/dist/drivers/BoxFileStorage.d.ts +539 -20
- package/dist/drivers/BoxFileStorage.d.ts.map +1 -1
- package/dist/drivers/BoxFileStorage.js +521 -20
- package/dist/drivers/BoxFileStorage.js.map +1 -1
- package/dist/drivers/DropboxFileStorage.d.ts +437 -15
- package/dist/drivers/DropboxFileStorage.d.ts.map +1 -1
- package/dist/drivers/DropboxFileStorage.js +431 -15
- package/dist/drivers/DropboxFileStorage.js.map +1 -1
- package/dist/drivers/GoogleDriveFileStorage.d.ts +342 -16
- package/dist/drivers/GoogleDriveFileStorage.d.ts.map +1 -1
- package/dist/drivers/GoogleDriveFileStorage.js +340 -16
- package/dist/drivers/GoogleDriveFileStorage.js.map +1 -1
- package/dist/drivers/GoogleFileStorage.d.ts +358 -2
- package/dist/drivers/GoogleFileStorage.d.ts.map +1 -1
- package/dist/drivers/GoogleFileStorage.js +356 -2
- package/dist/drivers/GoogleFileStorage.js.map +1 -1
- package/dist/drivers/SharePointFileStorage.d.ts +434 -20
- package/dist/drivers/SharePointFileStorage.d.ts.map +1 -1
- package/dist/drivers/SharePointFileStorage.js +453 -22
- package/dist/drivers/SharePointFileStorage.js.map +1 -1
- package/dist/generic/FileStorageBase.d.ts +326 -108
- package/dist/generic/FileStorageBase.d.ts.map +1 -1
- package/dist/generic/FileStorageBase.js +54 -6
- package/dist/generic/FileStorageBase.js.map +1 -1
- package/dist/util.d.ts +125 -18
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +125 -18
- package/dist/util.js.map +1 -1
- package/package.json +4 -4
- package/readme.md +211 -1
|
@@ -1,72 +1,398 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { CreatePreAuthUploadUrlPayload, FileStorageBase, StorageListResult, StorageObjectMetadata } from '../generic/FileStorageBase';
|
|
3
|
+
/**
|
|
4
|
+
* Google Drive implementation of the FileStorageBase interface.
|
|
5
|
+
*
|
|
6
|
+
* This class provides methods for interacting with Google Drive as a file storage provider.
|
|
7
|
+
* It implements most of the abstract methods defined in FileStorageBase and handles
|
|
8
|
+
* Google Drive-specific authentication, authorization, and file operations.
|
|
9
|
+
*
|
|
10
|
+
* Unlike other storage providers like S3 or Azure, Google Drive has native concepts of
|
|
11
|
+
* folders and files with hierarchical paths, which makes some operations more natural
|
|
12
|
+
* while others (like pre-authenticated upload URLs) are not directly supported.
|
|
13
|
+
*
|
|
14
|
+
* It requires one of the following environment variables to be set:
|
|
15
|
+
* - STORAGE_GDRIVE_KEY_FILE: Path to a service account key file with Drive permissions
|
|
16
|
+
* - STORAGE_GDRIVE_CREDENTIALS_JSON: A JSON object containing service account credentials
|
|
17
|
+
*
|
|
18
|
+
* Optionally, you can set:
|
|
19
|
+
* - STORAGE_GDRIVE_ROOT_FOLDER_ID: ID of a folder to use as the root (for isolation)
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Create an instance of GoogleDriveFileStorage
|
|
24
|
+
* const driveStorage = new GoogleDriveFileStorage();
|
|
25
|
+
*
|
|
26
|
+
* // Generate a pre-authenticated download URL
|
|
27
|
+
* const downloadUrl = await driveStorage.CreatePreAuthDownloadUrl('documents/report.pdf');
|
|
28
|
+
*
|
|
29
|
+
* // List files in a directory
|
|
30
|
+
* const files = await driveStorage.ListObjects('documents/');
|
|
31
|
+
*
|
|
32
|
+
* // Upload a file directly
|
|
33
|
+
* const uploaded = await driveStorage.PutObject('documents/report.pdf', fileData);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
3
36
|
export declare class GoogleDriveFileStorage extends FileStorageBase {
|
|
37
|
+
/** The name of this storage provider, used in error messages */
|
|
4
38
|
protected readonly providerName = "Google Drive";
|
|
39
|
+
/** The Google Drive API client */
|
|
5
40
|
private _drive;
|
|
41
|
+
/** Optional root folder ID to restrict operations to a specific folder */
|
|
6
42
|
private _rootFolderId?;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new instance of GoogleDriveFileStorage.
|
|
45
|
+
*
|
|
46
|
+
* Initializes the connection to Google Drive using either a service account
|
|
47
|
+
* key file or credentials provided directly in environment variables.
|
|
48
|
+
* Throws an error if neither authentication method is properly configured.
|
|
49
|
+
*/
|
|
7
50
|
constructor();
|
|
8
51
|
/**
|
|
9
|
-
* Finds a file or folder by path
|
|
52
|
+
* Finds a file or folder by path.
|
|
53
|
+
*
|
|
54
|
+
* This helper method navigates the Google Drive folder structure to find
|
|
55
|
+
* a file or folder at the specified path. It starts from the root (or the
|
|
56
|
+
* configured root folder) and traverses the path components one by one.
|
|
57
|
+
*
|
|
58
|
+
* @param path - The path to the file or folder to find
|
|
59
|
+
* @returns A Promise resolving to the Google Drive file object
|
|
60
|
+
* @throws Error if the path cannot be found
|
|
61
|
+
* @private
|
|
10
62
|
*/
|
|
11
63
|
private _getItemByPath;
|
|
12
64
|
/**
|
|
13
|
-
* Finds a parent folder by path and creates it if it doesn't exist
|
|
65
|
+
* Finds a parent folder by path and creates it if it doesn't exist.
|
|
66
|
+
*
|
|
67
|
+
* This helper method is used to ensure a folder path exists before
|
|
68
|
+
* creating or moving files. It navigates through each path component,
|
|
69
|
+
* creating folders as needed if they don't exist yet.
|
|
70
|
+
*
|
|
71
|
+
* @param path - The path to the folder to find or create
|
|
72
|
+
* @returns A Promise resolving to the ID of the folder
|
|
73
|
+
* @private
|
|
14
74
|
*/
|
|
15
75
|
private _getOrCreateParentFolder;
|
|
16
76
|
/**
|
|
17
|
-
* Helper method to convert Google Drive file to StorageObjectMetadata
|
|
77
|
+
* Helper method to convert Google Drive file objects to StorageObjectMetadata.
|
|
78
|
+
*
|
|
79
|
+
* This method transforms the Google Drive API's file representation into
|
|
80
|
+
* the standardized StorageObjectMetadata format used by the FileStorageBase
|
|
81
|
+
* interface. It handles special properties like folder detection and paths.
|
|
82
|
+
*
|
|
83
|
+
* @param file - The Google Drive file object to convert
|
|
84
|
+
* @param parentPath - The parent path to use for constructing the full path
|
|
85
|
+
* @returns A StorageObjectMetadata representation of the file
|
|
86
|
+
* @private
|
|
18
87
|
*/
|
|
19
88
|
private _fileToMetadata;
|
|
20
89
|
/**
|
|
21
|
-
*
|
|
90
|
+
* Creates a pre-authenticated upload URL for an object in Google Drive.
|
|
91
|
+
*
|
|
92
|
+
* Google Drive doesn't directly support pre-signed upload URLs in the same
|
|
93
|
+
* way as other storage providers like S3 or Azure. Instead, uploads
|
|
94
|
+
* should be performed using the PutObject method.
|
|
95
|
+
*
|
|
96
|
+
* @param objectName - The name of the object to upload
|
|
97
|
+
* @throws UnsupportedOperationError as this operation is not supported
|
|
22
98
|
*/
|
|
23
99
|
CreatePreAuthUploadUrl(objectName: string): Promise<CreatePreAuthUploadUrlPayload>;
|
|
24
100
|
/**
|
|
25
|
-
*
|
|
101
|
+
* Creates a pre-authenticated download URL for an object in Google Drive.
|
|
102
|
+
*
|
|
103
|
+
* This method creates a temporary, public sharing link for a file that allows
|
|
104
|
+
* anyone with the link to access the file for a limited time (10 minutes).
|
|
105
|
+
* It uses Google Drive's permissions system to create a temporary reader
|
|
106
|
+
* permission for 'anyone' with an expiration time.
|
|
107
|
+
*
|
|
108
|
+
* @param objectName - The path to the file to download
|
|
109
|
+
* @returns A Promise resolving to the download URL
|
|
110
|
+
* @throws Error if the file cannot be found or the URL creation fails
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* // Generate a pre-authenticated download URL for a PDF file
|
|
115
|
+
* const downloadUrl = await driveStorage.CreatePreAuthDownloadUrl('documents/report.pdf');
|
|
116
|
+
*
|
|
117
|
+
* // The URL can be shared with users or used in applications for direct download
|
|
118
|
+
* console.log(downloadUrl);
|
|
119
|
+
* ```
|
|
26
120
|
*/
|
|
27
121
|
CreatePreAuthDownloadUrl(objectName: string): Promise<string>;
|
|
28
122
|
/**
|
|
29
|
-
*
|
|
123
|
+
* Moves an object from one location to another within Google Drive.
|
|
124
|
+
*
|
|
125
|
+
* This method first locates the file to be moved, then gets or creates the
|
|
126
|
+
* destination folder, and finally updates the file's name and parent folder.
|
|
127
|
+
* Google Drive has native support for moving files between folders.
|
|
128
|
+
*
|
|
129
|
+
* @param oldObjectName - The current path of the object
|
|
130
|
+
* @param newObjectName - The new path for the object
|
|
131
|
+
* @returns A Promise resolving to a boolean indicating success
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* // Move a file from drafts to published folder
|
|
136
|
+
* const success = await driveStorage.MoveObject(
|
|
137
|
+
* 'drafts/report.docx',
|
|
138
|
+
* 'published/final-report.docx'
|
|
139
|
+
* );
|
|
140
|
+
*
|
|
141
|
+
* if (success) {
|
|
142
|
+
* console.log('File successfully moved');
|
|
143
|
+
* } else {
|
|
144
|
+
* console.log('Failed to move file');
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
30
147
|
*/
|
|
31
148
|
MoveObject(oldObjectName: string, newObjectName: string): Promise<boolean>;
|
|
32
149
|
/**
|
|
33
|
-
*
|
|
150
|
+
* Deletes an object from Google Drive.
|
|
151
|
+
*
|
|
152
|
+
* This method locates the specified file by path and deletes it from Google Drive.
|
|
153
|
+
* By default, this moves the file to the trash rather than permanently deleting it,
|
|
154
|
+
* unless your Drive settings are configured for immediate permanent deletion.
|
|
155
|
+
*
|
|
156
|
+
* @param objectName - The path to the file to delete
|
|
157
|
+
* @returns A Promise resolving to a boolean indicating success
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // Delete a temporary file
|
|
162
|
+
* const deleted = await driveStorage.DeleteObject('temp/report-draft.pdf');
|
|
163
|
+
*
|
|
164
|
+
* if (deleted) {
|
|
165
|
+
* console.log('File successfully deleted');
|
|
166
|
+
* } else {
|
|
167
|
+
* console.log('Failed to delete file');
|
|
168
|
+
* }
|
|
169
|
+
* ```
|
|
34
170
|
*/
|
|
35
171
|
DeleteObject(objectName: string): Promise<boolean>;
|
|
36
172
|
/**
|
|
37
|
-
*
|
|
173
|
+
* Lists objects in a directory in Google Drive.
|
|
174
|
+
*
|
|
175
|
+
* This method retrieves all files and folders directly inside the specified
|
|
176
|
+
* folder path. It handles Google Drive's native folder structure and converts
|
|
177
|
+
* the Drive API responses to the standardized StorageListResult format.
|
|
178
|
+
*
|
|
179
|
+
* @param prefix - The path to the directory to list
|
|
180
|
+
* @param delimiter - Delimiter character (unused in Google Drive implementation)
|
|
181
|
+
* @returns A Promise resolving to a StorageListResult containing objects and prefixes
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* // List all files and directories in the documents folder
|
|
186
|
+
* const result = await driveStorage.ListObjects('documents/');
|
|
187
|
+
*
|
|
188
|
+
* // Process files
|
|
189
|
+
* for (const file of result.objects) {
|
|
190
|
+
* console.log(`File: ${file.name}, Size: ${file.size}, Type: ${file.contentType}`);
|
|
191
|
+
* }
|
|
192
|
+
*
|
|
193
|
+
* // Process subdirectories
|
|
194
|
+
* for (const dir of result.prefixes) {
|
|
195
|
+
* console.log(`Directory: ${dir}`);
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
38
198
|
*/
|
|
39
199
|
ListObjects(prefix: string, delimiter?: string): Promise<StorageListResult>;
|
|
40
200
|
/**
|
|
41
|
-
*
|
|
201
|
+
* Creates a directory in Google Drive.
|
|
202
|
+
*
|
|
203
|
+
* This method creates a folder at the specified path, creating parent
|
|
204
|
+
* folders as needed if they don't exist. Google Drive natively supports
|
|
205
|
+
* folders as a special file type with the 'application/vnd.google-apps.folder'
|
|
206
|
+
* MIME type.
|
|
207
|
+
*
|
|
208
|
+
* @param directoryPath - The path of the directory to create
|
|
209
|
+
* @returns A Promise resolving to a boolean indicating success
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* // Create a new directory structure
|
|
214
|
+
* const created = await driveStorage.CreateDirectory('documents/reports/annual/');
|
|
215
|
+
*
|
|
216
|
+
* if (created) {
|
|
217
|
+
* console.log('Directory created successfully');
|
|
218
|
+
* } else {
|
|
219
|
+
* console.log('Failed to create directory');
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
42
222
|
*/
|
|
43
223
|
CreateDirectory(directoryPath: string): Promise<boolean>;
|
|
44
224
|
/**
|
|
45
|
-
*
|
|
225
|
+
* Deletes a directory and optionally its contents from Google Drive.
|
|
226
|
+
*
|
|
227
|
+
* This method deletes a folder at the specified path. If recursive is false,
|
|
228
|
+
* it will fail if the folder has any contents. If recursive is true, it
|
|
229
|
+
* deletes the folder and all its contents.
|
|
230
|
+
*
|
|
231
|
+
* @param directoryPath - The path of the directory to delete
|
|
232
|
+
* @param recursive - If true, deletes all contents recursively (default: false)
|
|
233
|
+
* @returns A Promise resolving to a boolean indicating success
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* // Delete an empty directory
|
|
238
|
+
* const deleted = await driveStorage.DeleteDirectory('documents/temp/');
|
|
239
|
+
*
|
|
240
|
+
* // Delete a directory and all its contents
|
|
241
|
+
* const recursivelyDeleted = await driveStorage.DeleteDirectory('documents/old_projects/', true);
|
|
242
|
+
* ```
|
|
46
243
|
*/
|
|
47
244
|
DeleteDirectory(directoryPath: string, recursive?: boolean): Promise<boolean>;
|
|
48
245
|
/**
|
|
49
|
-
*
|
|
246
|
+
* Retrieves metadata for a specific object in Google Drive.
|
|
247
|
+
*
|
|
248
|
+
* This method fetches the file information without downloading its content,
|
|
249
|
+
* which is more efficient for checking file attributes like size, type,
|
|
250
|
+
* and last modified date.
|
|
251
|
+
*
|
|
252
|
+
* @param objectName - The path to the file to get metadata for
|
|
253
|
+
* @returns A Promise resolving to a StorageObjectMetadata object
|
|
254
|
+
* @throws Error if the file doesn't exist or cannot be accessed
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```typescript
|
|
258
|
+
* try {
|
|
259
|
+
* const metadata = await driveStorage.GetObjectMetadata('documents/report.pdf');
|
|
260
|
+
* console.log(`File: ${metadata.name}`);
|
|
261
|
+
* console.log(`Size: ${metadata.size} bytes`);
|
|
262
|
+
* console.log(`Last modified: ${metadata.lastModified}`);
|
|
263
|
+
* } catch (error) {
|
|
264
|
+
* console.error('File does not exist or cannot be accessed');
|
|
265
|
+
* }
|
|
266
|
+
* ```
|
|
50
267
|
*/
|
|
51
268
|
GetObjectMetadata(objectName: string): Promise<StorageObjectMetadata>;
|
|
52
269
|
/**
|
|
53
|
-
*
|
|
270
|
+
* Downloads an object's content from Google Drive.
|
|
271
|
+
*
|
|
272
|
+
* This method retrieves the full content of a file and returns it
|
|
273
|
+
* as a Buffer for processing in memory.
|
|
274
|
+
*
|
|
275
|
+
* @param objectName - The path to the file to download
|
|
276
|
+
* @returns A Promise resolving to a Buffer containing the file's data
|
|
277
|
+
* @throws Error if the file doesn't exist or cannot be downloaded
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* try {
|
|
282
|
+
* const content = await driveStorage.GetObject('documents/config.json');
|
|
283
|
+
* // Parse the JSON content
|
|
284
|
+
* const config = JSON.parse(content.toString('utf8'));
|
|
285
|
+
* console.log('Configuration loaded:', config);
|
|
286
|
+
* } catch (error) {
|
|
287
|
+
* console.error('Failed to download file:', error.message);
|
|
288
|
+
* }
|
|
289
|
+
* ```
|
|
54
290
|
*/
|
|
55
291
|
GetObject(objectName: string): Promise<Buffer>;
|
|
56
292
|
/**
|
|
57
|
-
*
|
|
293
|
+
* Uploads data to an object in Google Drive.
|
|
294
|
+
*
|
|
295
|
+
* This method directly uploads a Buffer of data to a file with the specified path.
|
|
296
|
+
* It will create any necessary parent folders if they don't exist, and will update
|
|
297
|
+
* the file if it already exists or create a new one if it doesn't.
|
|
298
|
+
*
|
|
299
|
+
* @param objectName - The path to the file to upload
|
|
300
|
+
* @param data - The Buffer containing the data to upload
|
|
301
|
+
* @param contentType - Optional MIME type for the file (inferred from name if not provided)
|
|
302
|
+
* @param metadata - Optional key-value pairs of custom metadata (not supported in current implementation)
|
|
303
|
+
* @returns A Promise resolving to a boolean indicating success
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* // Upload a text file
|
|
308
|
+
* const content = Buffer.from('Hello, World!', 'utf8');
|
|
309
|
+
* const uploaded = await driveStorage.PutObject(
|
|
310
|
+
* 'documents/hello.txt',
|
|
311
|
+
* content,
|
|
312
|
+
* 'text/plain'
|
|
313
|
+
* );
|
|
314
|
+
*
|
|
315
|
+
* if (uploaded) {
|
|
316
|
+
* console.log('File uploaded successfully');
|
|
317
|
+
* } else {
|
|
318
|
+
* console.log('Failed to upload file');
|
|
319
|
+
* }
|
|
320
|
+
* ```
|
|
58
321
|
*/
|
|
59
322
|
PutObject(objectName: string, data: Buffer, contentType?: string, metadata?: Record<string, string>): Promise<boolean>;
|
|
60
323
|
/**
|
|
61
|
-
*
|
|
324
|
+
* Copies an object within Google Drive.
|
|
325
|
+
*
|
|
326
|
+
* This method creates a copy of a file at a new location without removing the original.
|
|
327
|
+
* It uses the Google Drive API's native file copying capabilities.
|
|
328
|
+
*
|
|
329
|
+
* @param sourceObjectName - The path to the file to copy
|
|
330
|
+
* @param destinationObjectName - The path where the copy should be created
|
|
331
|
+
* @returns A Promise resolving to a boolean indicating success
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* // Create a backup copy of an important file
|
|
336
|
+
* const copied = await driveStorage.CopyObject(
|
|
337
|
+
* 'documents/contract.pdf',
|
|
338
|
+
* 'backups/contract_2024-05-16.pdf'
|
|
339
|
+
* );
|
|
340
|
+
*
|
|
341
|
+
* if (copied) {
|
|
342
|
+
* console.log('File copied successfully');
|
|
343
|
+
* } else {
|
|
344
|
+
* console.log('Failed to copy file');
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
62
347
|
*/
|
|
63
348
|
CopyObject(sourceObjectName: string, destinationObjectName: string): Promise<boolean>;
|
|
64
349
|
/**
|
|
65
|
-
*
|
|
350
|
+
* Checks if an object exists in Google Drive.
|
|
351
|
+
*
|
|
352
|
+
* This method verifies the existence of a file at the specified path
|
|
353
|
+
* without downloading its content.
|
|
354
|
+
*
|
|
355
|
+
* @param objectName - The path to the file to check
|
|
356
|
+
* @returns A Promise resolving to a boolean indicating if the file exists
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* // Check if a file exists before attempting to use it
|
|
361
|
+
* const exists = await driveStorage.ObjectExists('documents/report.pdf');
|
|
362
|
+
*
|
|
363
|
+
* if (exists) {
|
|
364
|
+
* console.log('File exists, proceeding with download');
|
|
365
|
+
* const content = await driveStorage.GetObject('documents/report.pdf');
|
|
366
|
+
* // Process the content...
|
|
367
|
+
* } else {
|
|
368
|
+
* console.log('File does not exist');
|
|
369
|
+
* }
|
|
370
|
+
* ```
|
|
66
371
|
*/
|
|
67
372
|
ObjectExists(objectName: string): Promise<boolean>;
|
|
68
373
|
/**
|
|
69
|
-
*
|
|
374
|
+
* Checks if a directory exists in Google Drive.
|
|
375
|
+
*
|
|
376
|
+
* This method verifies the existence of a folder at the specified path.
|
|
377
|
+
* It also checks that the item is actually a folder (has the correct MIME type),
|
|
378
|
+
* not a file with the same name.
|
|
379
|
+
*
|
|
380
|
+
* @param directoryPath - The path of the directory to check
|
|
381
|
+
* @returns A Promise resolving to a boolean indicating if the directory exists
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* // Check if a directory exists before trying to save files to it
|
|
386
|
+
* const exists = await driveStorage.DirectoryExists('documents/reports/');
|
|
387
|
+
*
|
|
388
|
+
* if (!exists) {
|
|
389
|
+
* console.log('Directory does not exist, creating it first');
|
|
390
|
+
* await driveStorage.CreateDirectory('documents/reports/');
|
|
391
|
+
* }
|
|
392
|
+
*
|
|
393
|
+
* // Now safe to use the directory
|
|
394
|
+
* await driveStorage.PutObject('documents/reports/new-report.pdf', fileData);
|
|
395
|
+
* ```
|
|
70
396
|
*/
|
|
71
397
|
DirectoryExists(directoryPath: string): Promise<boolean>;
|
|
72
398
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleDriveFileStorage.d.ts","sourceRoot":"","sources":["../../src/drivers/GoogleDriveFileStorage.ts"],"names":[],"mappings":";AAIA,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,qBACa,sBAAuB,SAAQ,eAAe;IACzD,SAAS,CAAC,QAAQ,CAAC,YAAY,kBAAkB;
|
|
1
|
+
{"version":3,"file":"GoogleDriveFileStorage.d.ts","sourceRoot":"","sources":["../../src/drivers/GoogleDriveFileStorage.ts"],"names":[],"mappings":";AAIA,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBACa,sBAAuB,SAAQ,eAAe;IACzD,gEAAgE;IAChE,SAAS,CAAC,QAAQ,CAAC,YAAY,kBAAkB;IAEjD,kCAAkC;IAClC,OAAO,CAAC,MAAM,CAAiB;IAE/B,0EAA0E;IAC1E,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B;;;;;;OAMG;;IAiCH;;;;;;;;;;;OAWG;YACW,cAAc;IAgD5B;;;;;;;;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