Skip to content

Commit

Permalink
docs: Improve sanitizeDStorageUrl function documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Mar 3, 2025
1 parent f4acdee commit 965ee62
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/helpers/sanitizeDStorageUrl.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { STORAGE_NODE_URL } from "@hey/data/constants";

/**
* Returns the storage node link for a given hash.
* Returns the decentralized storage link for a given hash.
*
* @param hash The storage node hash.
* @returns The storage node link.
* @returns The decentralized storage link.
*/
const sanitizeDStorageUrl = (hash?: string): string => {
if (!hash) {
Expand Down
41 changes: 41 additions & 0 deletions script/truncate
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Usage: script/truncate
# Truncate all folders in the bucket

# Install s3cmd
# brew install s3cmd
# Config
# nano ~/.s3cfg
#
# [default]
# access_key = value
# secret_key = value
# host_base = endpoint.4everland.co
# host_bucket = %(bucket)s.endpoint.4everland.co
# use_https = True
# signature_v2 = False

BUCKET_NAME="hey-media"
folders=$(s3cmd ls s3://$BUCKET_NAME | awk '/DIR/ {print $NF}')

total_files_deleted=0

for folder in $folders; do
echo "Deleting folder: $folder"

# Count files in the folder
file_count=$(s3cmd ls --recursive "$folder" | wc -l)
echo "Files in folder: $file_count"

# Delete files recursively
s3cmd del --recursive "$folder"

echo "Deleted $file_count files from $folder"

# Update total files deleted
total_files_deleted=$((total_files_deleted + file_count))
done

echo "Total files deleted across all folders: $total_files_deleted"
echo "All folders deleted in bucket: $BUCKET_NAME"

0 comments on commit 965ee62

Please sign in to comment.