gdrivekit 1.0.8 → 1.0.9

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.
Files changed (3) hide show
  1. package/README.md +24 -0
  2. package/dist/index.js +125 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -159,6 +159,7 @@ main();
159
159
 
160
160
  | Method | Description |
161
161
  | --------------------- | --------------------------- |
162
+ | `shareFile()` | Share a file with a user |
162
163
  | `fileExists()` | Check if a file exists |
163
164
  | `getStorageQuota()` | Get storage quota information |
164
165
  | `getFolderIdByName()` | Fetch folder ID by its name |
@@ -167,6 +168,7 @@ main();
167
168
  ---
168
169
 
169
170
  ### ❴❵ **Json Operation**
171
+
170
172
  | Method | Description |
171
173
  | ----------------------- | ----------------------------------------- |
172
174
  | `readJsonFileData()` | Read JSON file content |
@@ -174,6 +176,28 @@ main();
174
176
  | `updateJsonFieldAndValues()` | Update an existing field in a JSON file |
175
177
  | `deleteJsonFieldAndKeys()` | Delete a field from a JSON file |
176
178
 
179
+ ---
180
+
181
+ ### ⚞ **Conversion Operation**
182
+
183
+ | Method | Description |
184
+ | ----------------------- | --------------------------------------------------------- |
185
+ | `convertTextToDocs()` | Convert a text file (`.txt`) to Google Docs format |
186
+ | `convertDocsToPdf()` | Convert a Google Docs file to PDF |
187
+ | `convertDocsToWord()` | Convert a Google Docs file to Microsoft Word (`.docx`) |
188
+ | `convertDocsToText()` | Convert a Google Docs file to plain text (`.txt`) |
189
+ | `convertCsvToSheet()` | Convert a CSV file to Google Sheets |
190
+ | `convertExcelToSheet()` | Convert an Excel file (`.xlsx`) to Google Sheets |
191
+ | `convertSheetToCsv()` | Convert a Google Sheet to CSV |
192
+ | `convertSheetToPdf()` | Convert a Google Sheet to PDF |
193
+ | `convertPptToSlides()` | Convert a PowerPoint file (`.pptx`) to Google Slides |
194
+ | `convertSlidesToPpt()` | Convert a Google Slides file to PowerPoint (`.pptx`) |
195
+ | `convertSlidesToPdf()` | Convert a Google Slides file to PDF |
196
+ | `convertPdfToDocs()` | Convert a PDF file to Google Docs (with OCR if supported) |
197
+ | `convertDrawingToPng()` | Convert a Google Drawing to PNG image |
198
+ | `convertDrawingToPdf()` | Convert a Google Drawing to PDF |
199
+
200
+
177
201
  ---
178
202
 
179
203
  ### ⚡ Example: Upload a File
package/dist/index.js CHANGED
@@ -778706,6 +778706,7 @@ __export(exports_operations, {
778706
778706
  uploadFile: () => uploadFile,
778707
778707
  updateJsonFieldAndValues: () => updateJsonFieldAndValues,
778708
778708
  updateFile: () => updateFile,
778709
+ shareFile: () => shareFile,
778709
778710
  searchStarredFiles: () => searchStarredFiles,
778710
778711
  searchSharedFiles: () => searchSharedFiles,
778711
778712
  searchModifiedAfter: () => searchModifiedAfter,
@@ -778750,12 +778751,23 @@ __export(exports_operations, {
778750
778751
  deleteFile: () => deleteFile,
778751
778752
  createFolder: () => createFolder,
778752
778753
  copyFile: () => copyFile,
778754
+ convertTextToDocs: () => convertTextToDocs,
778755
+ convertSlidesToPpt: () => convertSlidesToPpt,
778756
+ convertSlidesToPdf: () => convertSlidesToPdf,
778757
+ convertSheetToPdf: () => convertSheetToPdf,
778758
+ convertSheetToCsv: () => convertSheetToCsv,
778759
+ convertPptToSlides: () => convertPptToSlides,
778760
+ convertPdfToDocs: () => convertPdfToDocs,
778761
+ convertExcelToSheet: () => convertExcelToSheet,
778762
+ convertDrawingToPng: () => convertDrawingToPng,
778763
+ convertDrawingToPdf: () => convertDrawingToPdf,
778764
+ convertDocsToWord: () => convertDocsToWord,
778765
+ convertDocsToText: () => convertDocsToText,
778766
+ convertDocsToPdf: () => convertDocsToPdf,
778767
+ convertCsvToSheet: () => convertCsvToSheet,
778753
778768
  addJsonKeyValue: () => addJsonKeyValue
778754
778769
  });
778755
778770
 
778756
- // drivers/services.ts
778757
- var driveService;
778758
-
778759
778771
  // types/index.ts
778760
778772
  var MIME_TYPES = {
778761
778773
  FOLDER: "application/vnd.google-apps.folder",
@@ -778785,6 +778797,9 @@ var MIME_TYPES = {
778785
778797
  RAR: "application/x-rar-compressed"
778786
778798
  };
778787
778799
 
778800
+ // drivers/services.ts
778801
+ var driveService;
778802
+
778788
778803
  // operations.ts
778789
778804
  async function searchByNameHelper(name, type, searchType = "exact") {
778790
778805
  let query = searchType === "exact" ? `name='${name}'` : `name contains '${name}'`;
@@ -778806,7 +778821,10 @@ async function getIdByNameHelper(name, type) {
778806
778821
  item
778807
778822
  };
778808
778823
  }
778809
- return { success: false, error: `${type ? type.charAt(0).toUpperCase() + type.slice(1) : "Item"} not found` };
778824
+ return {
778825
+ success: false,
778826
+ error: `${type ? type.charAt(0).toUpperCase() + type.slice(1) : "Item"} not found`
778827
+ };
778810
778828
  }
778811
778829
  async function readFileData(fileId) {
778812
778830
  const response = await driveService.readFileData(fileId);
@@ -779153,6 +779171,9 @@ async function fileExists(fileName) {
779153
779171
  async function getStorageQuota() {
779154
779172
  return await driveService.getStorageQuota();
779155
779173
  }
779174
+ async function shareFile(fileId, emailAddress, role = "reader") {
779175
+ return await driveService.shareFile(fileId, emailAddress, role);
779176
+ }
779156
779177
  async function getFolderIdByName(folderName) {
779157
779178
  const result = await getIdByNameHelper(folderName, "folder");
779158
779179
  if (result.success) {
@@ -779175,6 +779196,90 @@ async function getFileIdByName(fileName) {
779175
779196
  }
779176
779197
  return { success: false, error: result.error };
779177
779198
  }
779199
+ async function convertTextToDocs(fileId) {
779200
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.DOCUMENT);
779201
+ if (response.success && response.data)
779202
+ return response.data;
779203
+ throw new Error(response.error || "Failed to convert Text → Google Docs");
779204
+ }
779205
+ async function convertDocsToPdf(fileId) {
779206
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.PDF);
779207
+ if (response.success && response.data)
779208
+ return response.data;
779209
+ throw new Error(response.error || "Failed to convert Docs → PDF");
779210
+ }
779211
+ async function convertDocsToWord(fileId) {
779212
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.WORD);
779213
+ if (response.success && response.data)
779214
+ return response.data;
779215
+ throw new Error(response.error || "Failed to convert Docs → Word");
779216
+ }
779217
+ async function convertDocsToText(fileId) {
779218
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.TEXT);
779219
+ if (response.success && response.data)
779220
+ return response.data;
779221
+ throw new Error(response.error || "Failed to convert Docs → Text");
779222
+ }
779223
+ async function convertCsvToSheet(fileId) {
779224
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.SPREADSHEET);
779225
+ if (response.success && response.data)
779226
+ return response.data;
779227
+ throw new Error(response.error || "Failed to convert CSV → Google Sheet");
779228
+ }
779229
+ async function convertExcelToSheet(fileId) {
779230
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.SPREADSHEET);
779231
+ if (response.success && response.data)
779232
+ return response.data;
779233
+ throw new Error(response.error || "Failed to convert Excel → Google Sheet");
779234
+ }
779235
+ async function convertSheetToCsv(fileId) {
779236
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.CSV);
779237
+ if (response.success && response.data)
779238
+ return response.data;
779239
+ throw new Error(response.error || "Failed to convert Sheet → CSV");
779240
+ }
779241
+ async function convertSheetToPdf(fileId) {
779242
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.PDF);
779243
+ if (response.success && response.data)
779244
+ return response.data;
779245
+ throw new Error(response.error || "Failed to convert Sheet → PDF");
779246
+ }
779247
+ async function convertPptToSlides(fileId) {
779248
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.PRESENTATION);
779249
+ if (response.success && response.data)
779250
+ return response.data;
779251
+ throw new Error(response.error || "Failed to convert PPT → Google Slides");
779252
+ }
779253
+ async function convertSlidesToPpt(fileId) {
779254
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.POWERPOINT);
779255
+ if (response.success && response.data)
779256
+ return response.data;
779257
+ throw new Error(response.error || "Failed to convert Slides → PPTX");
779258
+ }
779259
+ async function convertSlidesToPdf(fileId) {
779260
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.PDF);
779261
+ if (response.success && response.data)
779262
+ return response.data;
779263
+ throw new Error(response.error || "Failed to convert Slides → PDF");
779264
+ }
779265
+ async function convertPdfToDocs(fileId) {
779266
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.DOCUMENT);
779267
+ if (response.success && response.data)
779268
+ return response.data;
779269
+ throw new Error(response.error || "Failed to convert PDF → Google Docs");
779270
+ }
779271
+ async function convertDrawingToPng(fileId) {
779272
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.PNG);
779273
+ if (response.success && response.data)
779274
+ return response.data;
779275
+ throw new Error(response.error || "Failed to convert Drawing → PNG");
779276
+ }
779277
+ async function convertDrawingToPdf(fileId) {
779278
+ const response = await driveService.ConversionFunction(fileId, MIME_TYPES.PDF);
779279
+ if (response.success && response.data)
779280
+ return response.data;
779281
+ throw new Error(response.error || "Failed to convert Drawing → PDF");
779282
+ }
779178
779283
  var driveOperations = {
779179
779284
  readFileData,
779180
779285
  uploadFile,
@@ -779220,10 +779325,25 @@ var driveOperations = {
779220
779325
  uploadMultipleFiles,
779221
779326
  deleteMultipleFiles,
779222
779327
  downloadMultipleFiles,
779328
+ shareFile,
779223
779329
  fileExists,
779224
779330
  getStorageQuota,
779225
779331
  getFolderIdByName,
779226
- getFileIdByName
779332
+ getFileIdByName,
779333
+ convertTextToDocs,
779334
+ convertDocsToPdf,
779335
+ convertDocsToWord,
779336
+ convertDocsToText,
779337
+ convertCsvToSheet,
779338
+ convertExcelToSheet,
779339
+ convertSheetToCsv,
779340
+ convertSheetToPdf,
779341
+ convertPptToSlides,
779342
+ convertSlidesToPpt,
779343
+ convertSlidesToPdf,
779344
+ convertPdfToDocs,
779345
+ convertDrawingToPng,
779346
+ convertDrawingToPdf
779227
779347
  };
779228
779348
 
779229
779349
  // auth.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdrivekit",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "A lightweight Google Drive toolkit for File Management. Handle Google Drive operations easily — upload, download, and other file operations in a few lines of code.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",