@xuda.io/drive_module 1.1.491 → 1.1.493

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 (2) hide show
  1. package/index.js +1 -161
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1901,9 +1901,6 @@ const upload_file_to_spaces = async function (
1901
1901
  });
1902
1902
 
1903
1903
  const fs = require("fs");
1904
-
1905
- // const fileName = "favicon.png";
1906
- // const filePath = path.join("/var/xuda", fileName);
1907
1904
  const fileContent = fs.readFileSync(tempPath);
1908
1905
 
1909
1906
  const params = {
@@ -1968,10 +1965,6 @@ exports.copy_file_to_another_bucket = async function (
1968
1965
  })
1969
1966
  .promise();
1970
1967
 
1971
- // console.log(
1972
- // `File copied successfully from ${source_region}/${file_name} to ${target_region}/${file_name}`,
1973
- // ret
1974
- // );
1975
1968
  ret.Location = `${_conf.storage_bucket[target_region].endpoint}/${target_region}/${file_name}`;
1976
1969
  ret.key = file_name;
1977
1970
  ret.Key = file_name;
@@ -2097,157 +2090,4 @@ const get_folder_docs = async function (dir, drive_type, app_id) {
2097
2090
  return docs;
2098
2091
  };
2099
2092
 
2100
- // exports.delete_folder_from_bucket = async function (folder_name) {
2101
- // // Import required libraries
2102
- // const {
2103
- // S3Client,
2104
- // ListObjectsV2Command,
2105
- // DeleteObjectsCommand,
2106
- // } = require("@aws-sdk/client-s3");
2107
-
2108
- // // Configure your DigitalOcean Spaces or S3 details
2109
-
2110
- // const SPACE_NAME = "dev.xuda.io";
2111
- // const FOLDER_PATH = "/workspace/prj3937cb6f9a31c8c7dea25055bba845b1"; // The key of the file you want to delete
2112
-
2113
- // const s3Client = new S3Client({
2114
- // region: _conf.storage_bucket[process.env.XUDA_HOSTNAME].region,
2115
- // endpoint: _conf.storage_bucket[process.env.XUDA_HOSTNAME].endpoint,
2116
- // credentials: {
2117
- // accessKeyId: _conf.digitalocean.spaces_access_key,
2118
- // secretAccessKey: _conf.digitalocean.spaces_secret_key,
2119
- // },
2120
- // });
2121
-
2122
- // // Function to delete a folder
2123
- // async function deleteFolder() {
2124
- // try {
2125
- // // List all objects in the folder
2126
- // const listedObjects = await s3Client.send(
2127
- // new ListObjectsV2Command({
2128
- // Bucket: SPACE_NAME,
2129
- // // Prefix: FOLDER_PATH,
2130
- // })
2131
- // );
2132
- // debugger;
2133
- // if (listedObjects.Contents.length === 0) return;
2134
-
2135
- // // Prepare a list of objects to delete
2136
- // const deleteParams = {
2137
- // Bucket: SPACE_NAME,
2138
- // Delete: { Objects: [] },
2139
- // };
2140
-
2141
- // listedObjects.Contents.forEach(({ Key }) => {
2142
- // deleteParams.Delete.Objects.push({ Key });
2143
- // });
2144
-
2145
- // // Delete the objects
2146
- // await s3Client.send(new DeleteObjectsCommand(deleteParams));
2147
-
2148
- // // Check if there are more objects to delete (pagination)
2149
- // if (listedObjects.IsTruncated) await deleteFolder();
2150
- // } catch (err) {
2151
- // console.log("Error", err);
2152
- // }
2153
- // }
2154
-
2155
- // // Call the function to delete the folder
2156
- // deleteFolder();
2157
-
2158
- // // return
2159
- // // const { S3Client, DeleteObjectCommand } = require("@aws-sdk/client-s3");
2160
-
2161
- // // // Configure your DigitalOcean Spaces details
2162
-
2163
- // // const SPACE_NAME = "dev.xuda.io";
2164
- // // const FILE_KEY = "workspace/prj3937cb6f9a31c8c7dea25055bba845b1/"; // The key of the file you want to delete
2165
-
2166
- // // // Create an S3 client
2167
- // // const s3Client = new S3Client({
2168
- // // region: _conf.storage_bucket[process.env.XUDA_HOSTNAME].region,
2169
- // // endpoint: _conf.storage_bucket[process.env.XUDA_HOSTNAME].endpoint,
2170
- // // credentials: {
2171
- // // accessKeyId: _conf.digitalocean.spaces_access_key,
2172
- // // secretAccessKey: _conf.digitalocean.spaces_secret_key,
2173
- // // },
2174
- // // });
2175
-
2176
- // // // Function to delete an object
2177
- // // async function deleteObjectFromSpaces() {
2178
- // // try {
2179
- // // const data = await s3Client.send(
2180
- // // new DeleteObjectCommand({
2181
- // // Bucket: SPACE_NAME,
2182
- // // Key: FILE_KEY,
2183
- // // })
2184
- // // );
2185
- // // console.log("Success", data);
2186
- // // } catch (err) {
2187
- // // console.log("Error", err);
2188
- // // }
2189
- // // }
2190
-
2191
- // // // Call the function to delete the object
2192
- // // deleteObjectFromSpaces();
2193
-
2194
- // // return;
2195
- // // const AWS = require("aws-sdk");
2196
-
2197
- // // // Configure the AWS SDK to use DigitalOcean Spaces
2198
- // // const spacesEndpoint = new AWS.Endpoint(
2199
- // // _conf.storage_bucket[process.env.XUDA_HOSTNAME].endpoint
2200
- // // );
2201
- // // const s3 = new AWS.S3({
2202
- // // endpoint: spacesEndpoint,
2203
- // // accessKeyId: _conf.digitalocean.spaces_access_key,
2204
- // // secretAccessKey: _conf.digitalocean.spaces_secret_key,
2205
- // // region: _conf.storage_bucket[process.env.XUDA_HOSTNAME].region,
2206
- // // });
2207
-
2208
- // // try {
2209
- // // debugger;
2210
-
2211
- // // // const params = {
2212
- // // // Bucket: "dev.xuda.io",
2213
- // // // };
2214
-
2215
- // // // s3.listObjectsV2(params, function (err, data) {
2216
- // // // if (err) console.log(err, err.stack); // an error occurred
2217
- // // // else console.log(data); // successful response
2218
- // // // });
2219
-
2220
- // // const ret = await s3
2221
- // // .listObjectsV2({
2222
- // // Bucket: "dev.xuda.io",
2223
- // // // Prefix: "",
2224
- // // })
2225
- // // .promise();
2226
-
2227
- // // // const ret = await s3.send(
2228
- // // // new ListObjectsV2Command({
2229
- // // // Bucket: "dev.xuda.io",
2230
- // // // Prefix: "workspace/",
2231
- // // // // ContinuationToken: continuationToken,
2232
- // // // })
2233
- // // // );
2234
-
2235
- // // console.log(ret);
2236
-
2237
- // // // for await (let [key, val] of Object.entries(_conf.storage_bucket)) {
2238
- // // // const ret = await s3
2239
- // // // .listObjectsV2({
2240
- // // // Bucket: key,
2241
- // // // Prefix: "/",
2242
- // // // })
2243
- // // // .promise();
2244
- // // // console.log(ret);
2245
- // // // }
2246
- // // // return data;
2247
- // // } catch (err) {
2248
- // // console.error("Error", err);
2249
- // // }
2250
- // };
2251
- setTimeout(function () {
2252
- // exports.delete_folder_from_bucket();
2253
- }, 2000);
2093
+ setTimeout(function () {}, 2000);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.491",
3
+ "version": "1.1.493",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {