Skip to content

Commit

Permalink
remove debugging comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisaCG committed Apr 12, 2024
1 parent 887db6d commit e987030
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/s3contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ export class Drive implements Contents.IDrive {
while (isTruncated) {
const { Contents, IsTruncated, NextContinuationToken } =
await this._s3Client.send(command);
console.log(Contents);

if (Contents) {
Contents.forEach(c => {
Expand Down Expand Up @@ -550,8 +549,6 @@ export class Drive implements Contents.IDrive {
* @returns A promise which resolves when the file is deleted.
*/
async delete(localPath: string): Promise<void> {
console.log('DELETE, local path: ', localPath);

// check if we are dealing with a directory
const info = await this.s3Client.send(
new ListObjectsV2Command({
Expand All @@ -568,7 +565,6 @@ export class Drive implements Contents.IDrive {
localPath = localPath + '/';
isDir = 1;
}
console.log('DELETE, local path: ', localPath);

const response = await this.s3Client.send(
new DeleteObjectCommand({
Expand All @@ -591,13 +587,9 @@ export class Drive implements Contents.IDrive {
while (isTruncated) {
const { Contents, IsTruncated, NextContinuationToken } =
await this._s3Client.send(command);
console.log(Contents);

if (Contents) {
Contents.forEach(c => {
const fileName = c.Key!.split('/')[c.Key!.split.length - 1];
console.log('DELETE, filename: ', fileName);
console.log('DELETE, key: ', c.Key);
this.delete_file(c.Key!);
});
}
Expand Down Expand Up @@ -645,7 +637,6 @@ export class Drive implements Contents.IDrive {
Prefix: oldLocalPath
})
);
console.log(info);

let isDir: boolean = false;
if (
Expand All @@ -657,9 +648,6 @@ export class Drive implements Contents.IDrive {
isDir = true;
}

console.log('RENAME, old path: ', oldLocalPath);
console.log('RENAME, new path: ', newLocalPath);

// retrieve information of old file
const fileContents = await this._s3Client.send(
new GetObjectCommand({
Expand Down Expand Up @@ -710,7 +698,7 @@ export class Drive implements Contents.IDrive {
Body: body
})
);
console.log(response);
console.log('RENAME, response', response);

// in the case of renaming a directory, move files to new location
if (isDir) {
Expand All @@ -725,7 +713,6 @@ export class Drive implements Contents.IDrive {
while (isTruncated) {
const { Contents, IsTruncated, NextContinuationToken } =
await this._s3Client.send(command);
console.log(Contents);

if (Contents) {
Contents.forEach(c => {
Expand Down Expand Up @@ -852,20 +839,16 @@ export class Drive implements Contents.IDrive {
localPath: string,
options: Partial<Contents.IModel> = {}
): Promise<Contents.IModel> {
console.log('SAVE, local path: ', localPath);
const fileName =
localPath.indexOf('/') === -1
? localPath
: localPath.split('/')[localPath.split.length - 1];

// console.log('SAVE, option content: ', typeof(options?.content), options.format)
let body: string;
if (options.format === 'json') {
body = JSON.stringify(options?.content, null, 2);
console.log('SAVE, json content: ', body);
} else {
body = options?.content;
console.log('SAVE, text content: ', body);
}

// save file with new content by overwritting existing file
Expand Down Expand Up @@ -903,8 +886,6 @@ export class Drive implements Contents.IDrive {
writable: true,
type: fileType
};
// console.log('body: ', body)
// console.log('info.body: ', await info.Body?.transformToString())

Contents.validateContentsModel(data);

Expand Down Expand Up @@ -990,7 +971,7 @@ export class Drive implements Contents.IDrive {
Key: toDir !== '' ? toDir + '/' + newFileName : newFileName
})
);
console.log('COPY resp: ', copy_response);
console.log('COPY response: ', copy_response);

// retrieve information of new file
const newFileContents = await this._s3Client.send(
Expand Down Expand Up @@ -1084,7 +1065,6 @@ export class Drive implements Contents.IDrive {
* @param name bucket name
*/
async setBucketCORS(name: string) {
console.log('SET BUCKET CORS, name: ', name);
const response = await this.s3Client.send(
new PutBucketCorsCommand({
Bucket: name,
Expand Down Expand Up @@ -1139,7 +1119,7 @@ export class Drive implements Contents.IDrive {
Key: newPath + fileName
})
);
console.log('RENAME, copy resp: ', copy_response);
console.log('RENAME, file inside directory copy resp: ', copy_response);
}

/**
Expand Down

0 comments on commit e987030

Please sign in to comment.